iOS Developer Library

Developer

iAd Framework Reference ADBannerViewDelegate Protocol Reference

Options
Deployment Target:

On This Page
Language:

ADBannerViewDelegate

The ADBannerViewDelegate protocol is implemented by an object to react to changes in an ADBannerView object. The banner view calls its delegate when a new advertisement is loaded, when the user interacts with an advertisement, and when errors occur.

Inheritance


Not Applicable

Import Statement


Swift

import iAd

Objective-C

@import iAd;

Availability


Available in iOS 4.0 and later.
  • Called before a new banner advertisement is loaded.

    Declaration

    Swift

    optional func bannerViewWillLoadAd(_ banner: ADBannerView!)

    Objective-C

    - (void)bannerViewWillLoadAd:(ADBannerView *)banner

    Parameters

    banner

    The banner view that is about to load a new advertisement.

    Import Statement

    Objective-C

    @import iAd;

    Swift

    import iAd

    Availability

    Available in iOS 5.0 and later.

  • Called when a new banner advertisement is loaded.

    Declaration

    Swift

    optional func bannerViewDidLoadAd(_ banner: ADBannerView!)

    Objective-C

    - (void)bannerViewDidLoadAd:(ADBannerView *)banner

    Parameters

    banner

    The banner view that loaded a new advertisement.

    Discussion

    Your application implements this method to be notified when a new advertisement is ready for display.

    Import Statement

    Objective-C

    @import iAd;

    Swift

    import iAd

    Availability

    Available in iOS 4.0 and later.

  • Called before a banner view executes an action.

    Declaration

    Swift

    optional func bannerViewActionShouldBegin(_ banner: ADBannerView!, willLeaveApplication willLeave: Bool) -> Bool

    Objective-C

    - (BOOL)bannerViewActionShouldBegin:(ADBannerView *)banner willLeaveApplication:(BOOL)willLeave

    Parameters

    banner

    The banner view that the user tapped.

    willLeave

    YEStrue if another application will be launched to execute the action; NOfalse if the action is going to be executed inside your application.

    Return Value

    Your delegate returns YEStrue if the banner action should execute; NOfalse to prevent the banner action from executing.

    Discussion

    This method is called when the user taps the banner view. Your application controls whether the action is triggered. To allow the action to be triggered, return YEStrue. To suppress the action, return NOfalse. Your application should almost always allow actions to be triggered; preventing actions may alter the advertisements your application sees and reduce the revenue your application earns through iAd.

    If the willLeave parameter is YEStrue, then your application is moved to the background shortly after this method returns. In this situation, your method implementation does not need to perform additional work. If willLeave is set to NOfalse, then the triggered action will cover your application’s user interface to show the advertising action. Although your application continues to run normally, your implementation of this method should disable activities that require user interaction while the action is executing. For example, a game might pause its game play until the user finishes watching the advertisement.

    Import Statement

    Objective-C

    @import iAd;

    Swift

    import iAd

    Availability

    Available in iOS 4.0 and later.

  • Called after a banner view finishes executing an action that covered your application’s user interface.

    Declaration

    Swift

    optional func bannerViewActionDidFinish(_ banner: ADBannerView!)

    Objective-C

    - (void)bannerViewActionDidFinish:(ADBannerView *)banner

    Parameters

    banner

    The banner view that finished executing an action.

    Discussion

    If your delegate paused activities before allowing an action to run, it should resume those activities when this method is called.

    Import Statement

    Objective-C

    @import iAd;

    Swift

    import iAd

    Availability

    Available in iOS 4.0 and later.