# 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
