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
UIViewController
object thatAdView
uses to show a modal controller in response to the user’s interaction with the banner.Remark
Since a singleUIViewController
can’t show multiple modal controllers simultaneously, the returnedUIViewController
must be displayed in front of all the other ones.Declaration
Swift
@objc optional func viewControllerForPresentingModalView() -> UIViewController?
Return Value
The
UIViewController
object thatAdView
uses 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
adView
A reference to the object of the
AdView
class that invoked the method.error
Information 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
adView
A reference to the object of the
AdView
class 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
adView
A reference to the object of the
AdView
class that invoked the method.viewController
Modal
UIViewController
. -
Notifies delegate when an impression was tracked.
Declaration
Swift
@objc(adView:didTrackImpressionWithData:) optional func adView(_ adView: AdView, didTrackImpression impressionData: ImpressionData?)
Parameters
adView
A reference to the object of the
AdView
class that invoked the method.impressionData
Ad 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
adView
A reference to the object that invoked the method.