AdViewDelegate
@objc(YMAAdViewDelegate)
public protocol AdViewDelegate : NSObjectProtocol
The protocol defines the methods of a delegate that monitors the ads.
Remark
Methods are called by an object of theAdView class when its state changes.
-
Returns a
UIViewControllerobject thatAdViewuses to show a modal controller in response to the user’s interaction with the banner.Remark
Since a singleUIViewControllercan’t show multiple modal controllers simultaneously, the returnedUIViewControllermust be displayed in front of all the other ones.Declaration
Swift
@objc optional func viewControllerForPresentingModalView() -> UIViewController?Return Value
The
UIViewControllerobject thatAdViewuses for showing a modal controller in response to the user’s interaction with the banner. -
Notifies that the banner failed to load.
Declaration
Swift
@objc optional func adViewDidFailLoading(_ adView: AdView, error: Error)Parameters
adViewA reference to the object of the
AdViewclass that invoked the method.errorInformation about the error (for details, see
AdErrorCode). -
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
Swift
@objc optional func adViewWillLeaveApplication(_ adView: AdView)Parameters
adViewA reference to the object of the
AdViewclass that invoked the method. -
Notifies that the user has clicked on the banner and the in-app browser will open now.
Declaration
Swift
@objc optional func adView(_ adView: AdView, willPresentScreen viewController: UIViewController?)Parameters
adViewA reference to the object of the
AdViewclass that invoked the method.viewControllerModal
UIViewController. -
Notifies delegate when an impression was tracked.
Declaration
Swift
@objc(adView:didTrackImpressionWithData:) optional func adView(_ adView: AdView, didTrackImpression impressionData: ImpressionData?)Parameters
adViewA reference to the object of the
AdViewclass that invoked the method.impressionDataAd impression-level revenue data.
-
Notifies that the user has chosen a reason for closing the ad and the ad must be hidden.
Warning
Advertising will not be hidden. The developer must determine what to do with the ad after the reason for closing it is chosen.Declaration
Swift
@objc(closeAdView:) optional func close(_ adView: AdView)Parameters
adViewA reference to the object that invoked the method.