YMAAdViewDelegate

Objective-C

@protocol YMAAdViewDelegate <NSObject>

Swift

protocol YMAAdViewDelegate : NSObjectProtocol

The protocol defines the methods of the delegate that tracks ads. Methods are called by an object of the YMAAdView class when its state changes.

  1. Methods
  2. -viewControllerForPresentingModalView
  3. -adViewDidLoad:
  4. -adViewDidFailLoading:error:
  5. -adViewDidClick:
  6. -adViewWillLeaveApplication:
  7. -adView:willPresentScreen:
  8. -adView:didDismissScreen:
  9. -adView:didTrackImpressionWithData:

Methods

-viewControllerForPresentingModalView

Returns a UIViewController object that AdView uses to show a modal controller in response to the user’s interaction with the banner. Since a single UIViewController can’t show multiple modal controllers simultaneously, the returned UIViewController must be displayed in front of all the other ones.

Declaration

Objective-C

- (nullable UIViewController *)viewControllerForPresentingModalView;

Swift

optional func viewControllerForPresentingModalView() -> UIViewController?

Return Value

The UIViewController object that AdView uses for showing a modal controller in response to the user’s interaction with the banner.

-adViewDidLoad:

Notifies that the banner is loaded. At this time, you can add AdView if you haven’t done so yet.

Declaration

Objective-C

- (void)adViewDidLoad:(nonnull YMAAdView *)adView;

Swift

optional func adViewDidLoad(_ adView: YMAAdView)

Parameters

adView

A reference to the object of the YMAAdView class that invoked the method.

adView

A reference to the object of the YMAAdView class that invoked the method.

-adViewDidFailLoading:error:

Notifies that the banner failed to load.

Declaration

Objective-C

- (void)adViewDidFailLoading:(nonnull YMAAdView *)adView
                       error:(nonnull NSError *)error;

Swift

optional func adViewDidFailLoading(_ adView: YMAAdView, error: Error)

Parameters

adView

A reference to the object of the YMAAdView class that invoked the method.

error

Information about the error (for details, see YMAAdErrorCode).

adView

A reference to the object of the YMAAdView class that invoked the method.

error

Information about the error (for details, see YMAAdErrorCode).

-adViewDidClick:

Notifies that the user clicked on the banner.

Declaration

Objective-C

- (void)adViewDidClick:(nonnull YMAAdView *)adView;

Swift

optional func adViewDidClick(_ adView: YMAAdView)

Parameters

adView

A reference to the object of the YMAAdView class that invoked the method.

adView

A reference to the object of the YMAAdView class that invoked the method.

-adViewWillLeaveApplication:

Notifies that the app will become inactive now because the user clicked on the banner ad and is about to switch to a different application (Phone, App Store, and so on).

Declaration

Objective-C

- (void)adViewWillLeaveApplication:(nonnull YMAAdView *)adView;

Swift

optional func adViewWillLeaveApplication(_ adView: YMAAdView)

Parameters

adView

A reference to the object of the YMAAdView class that invoked the method.

adView

A reference to the object of the YMAAdView class that invoked the method.

-adView:willPresentScreen:

Notifies that the user has clicked on the banner and the in-app browser will open now.

Declaration

Objective-C

- (void)adView:(nonnull YMAAdView *)adView
    willPresentScreen:(nullable UIViewController *)viewController;

Swift

optional func adView(_ adView: YMAAdView, willPresentScreen viewController: UIViewController?)

Parameters

adView

A reference to the object of the YMAAdView class that invoked the method.

viewController

Modal UIViewController.

adView

A reference to the object of the YMAAdView class that invoked the method.

viewController

Modal UIViewController.

-adView:didDismissScreen:

Notifies that the user has closed the embedded browser.

Declaration

Objective-C

- (void)adView:(nonnull YMAAdView *)adView
    didDismissScreen:(nullable UIViewController *)viewController;

Swift

optional func adView(_ adView: YMAAdView, didDismissScreen viewController: UIViewController?)

Parameters

adView

A reference to the object of the YMAAdView class that invoked the method.

viewController

Modal UIViewController.

adView

A reference to the object of the YMAAdView class that invoked the method.

viewController

Modal UIViewController.

-adView:didTrackImpressionWithData:

It’s called when an ad impression has been counted.

Declaration

Objective-C

- (void)adView:(nonnull YMAAdView *)adView
    didTrackImpressionWithData:(nullable id<YMAImpressionData>)impressionData;

Parameters

adView

A reference to the object of the YMAAdView class that invoked the method.

impressionData

Revenue data at the level of ad impressions.

adView

A reference to the object of the YMAAdView class that invoked the method.

impressionData

Revenue data at the level of ad impressions.