# CESplash2Ad

## Overview

`CESplash2AD` is used to request interstital ad.

## Interface

### `eventDelegate`

#### Declaration

```objectivec
@property (nonatomic, weak, nullable) id<CESplash2ADEventDelegate> eventDelegate;
```

#### Discussion

Delegate which is notified by SDK when `CESplash2Ad` triggered the ad event.

### `ad`

#### Declaration

```
@property (nonatomic, strong, readonly, nullable) Ad * ad;
```

#### Discussion

An `Ad` object containing data of the loaded ad.

### `- loadAdInstantWithInfo:`

#### Declaration

```objectivec
- (BOOL)loadAdInstantWithInfo:(nonnull CERequestInfo *)info
                        error:(NSError **)error;
```

#### Parameters

| name  | description                                                             |
| ----- | ----------------------------------------------------------------------- |
| info  | `CERequestInfo` instance used to specify the parameters for ad request. |
| error | `NSError` instance used to specify the error for ad request.            |

#### Discussion

Start loading ad content process synchronously, and it will ignore the timeout in CERequestInfo.

### `- loadAdAsyncWithInfo:`

#### Declaration

```objectivec
- (void)loadAdAsyncWithInfo:(nonnull CERequestInfo *)info
                reqDelegate:(id<CESplash2ADRequestDelegate>)reqDelegate;
```

#### Parameters

| name        | description                                                             |
| ----------- | ----------------------------------------------------------------------- |
| info        | `CERequestInfo` instance used to specify the parameters for ad request. |
| reqDelegate | id\<CESplash2ADRequestDelegate> instance that receive request ad event. |

#### Discussion

Start loading ad content process asynchronously. Use this api with timeout greater than 0 if you can wait for loading an interstitial ad. In most cases you should `preload` the ad and show the ad with `loadAdInstantWithInfo` to have better UX between UI transitions.

### `- showFromViewController:`

#### Declaration

```
- (void) showFromViewController:(nonnull UIViewController *)viewController
                       animated:(BOOL)animated;
```

#### Parameters

| name           | description                                                       |
| -------------- | ----------------------------------------------------------------- |
| viewController | The view controller from which interstitial ad will be presented. |
| animated       | `YES` to show the interstitial ad with animation; otherwise, `NO` |

#### Discussion

Use this method to present an interstitial ad when it is loaded.

### `- dismissAnimated:`

#### Declaration

```
- (void) dismissAnimated:(BOOL)animated;
```

#### Parameters

| name     | description                                                           |
| -------- | --------------------------------------------------------------------- |
| animated | `YES` to dismiss the interstitial ad with animation; otherwise, `NO`. |

#### Discussion

Use this method to dismiss the interstitial ad.

### `- setDismissAdAfterEngageAd:`

#### Declaration

```
- (void) setDismissAdAfterEngageAd:(BOOL)dismissAd;
```

#### Parameters

| name      | description                                                                                                            |
| --------- | ---------------------------------------------------------------------------------------------------------------------- |
| dismissAd | `YES` to automatically dismiss interstitial ad if it opens the browser/webview due to user engagement; otherwise, `NO` |

#### Discussion

Use this method to automatically dismiss interstitial ad after user is back from the redirect browser/webview. The default is `NO`.

### `- setPortraitViewControllerPresentAnimation:dismissAnimation:`

#### Declaration

```
- (void) setPortraitViewControllerPresentAnimation:(CEPortraitPresentAnimationOption)presentAnimation
                                  dismissAnimation:(CEPortraitDismissAnimationOption)dismissAnimation;
```

#### Parameters

| name             | description                                  |
| ---------------- | -------------------------------------------- |
| presentAnimation | Present animation option for interstitial ad |
| dismissAnimation | Dismiss animation option for interstitial ad |

#### Discussion

Use this method to set the built-in animation option for portrait interstitial ad.

### `- setLandscapeViewControllerPresentAnimation:dismissAnimation:`

#### Declaration

```
- (void) setLandscapeViewControllerPresentAnimation:(CELandscapePresentAnimationOption)presentAnimation
                                   dismissAnimation:(CELandscapeDismissAnimationOption)dismissAnimation;
```

#### Parameters

| name             | description                                  |
| ---------------- | -------------------------------------------- |
| presentAnimation | Present animation option for interstitial ad |
| dismissAnimation | Dismiss animation option for interstitial ad |

#### Discussion

Use this method to set the built-in animation option for landscape interstitial ad.

### `- setCustomPortraitViewControllerPresentAnimation:dismissAnimation:`

#### Declaration

```
- (void) setCustomPortraitViewControllerPresentAnimation:(nonnull id<UIViewControllerAnimatedTransitioning>)presentAnimation
                                        dismissAnimation:(nonnull id<UIViewControllerAnimatedTransitioning>)dismissAnimation;
```

#### Parameters

| name             | description                                                                                     |
| ---------------- | ----------------------------------------------------------------------------------------------- |
| presentAnimation | Object implementing `UIViewControllerAnimatedTransitioning` for the present of interstitial ad. |
| dismissAnimation | Object implementing `UIViewControllerAnimatedTransitioning` for the dismiss of interstitial ad. |

#### Discussion

Use this method to set the custom transition effect for portrait interstitial ad.

### `- setCustomLandscapeViewControllerPresentAnimation:dismissAnimation:`

#### Declaration

```
- (void) setCustomLandscapeViewControllerPresentAnimation:(nonnull id<UIViewControllerAnimatedTransitioning>)presentAnimation
                                         dismissAnimation:(nonnull id<UIViewControllerAnimatedTransitioning>)dismissAnimation;
```

#### Parameters

| name             | description                                                                                     |
| ---------------- | ----------------------------------------------------------------------------------------------- |
| presentAnimation | Object implementing `UIViewControllerAnimatedTransitioning` for the present of interstitial ad. |
| dismissAnimation | Object implementing `UIViewControllerAnimatedTransitioning` for the dismiss of interstitial ad. |

#### Discussion

Use this method to set the custom transition effect for landscape interstitial ad.

### `- getTotalFileSize`

#### Declaration

```
- (long long)getTotalFileSize;
```

#### Return Value

The total size of the creative files downloaded for this ad.

### `- isSplashAdVC`

#### Declaration

```
- (BOOL) isSplashAdVC:(nonnull UIViewController *)vc;
```

#### Parameters

| name           | description         |
| -------------- | ------------------- |
| viewController | The view controller |

#### Discussion

Return whether viewcontroller is a Splash AD viewcontroller

#### Return Value

bool to indicate viewcontroller is a CrystalExpress Splash AD viewcontroller


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://intowow.gitbook.io/crystalexpress-documentation-v3-x/ios-sdk/api-reference/cesplash2ad.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
