ADBannerViewDelegate Protocol Reference

Conforms to
Framework
/System/Library/Frameworks/iAd.framework
Availability
Available in iOS 4.0 and later.
Companion guide
Declared in
ADBannerView.h
Related sample code

Overview

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.

Tasks

Detecting When Advertisements Are Loaded

Detecting When a User Interacts With an Advertisement

Detecting Errors

Instance Methods

bannerView:didFailToReceiveAdWithError:

Called when a banner view fails to load a new advertisement.

- (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error
Parameters
banner

The banner view that failed to load an advertisement.

error

The error object that describes the problem.

Availability
  • Available in iOS 4.0 and later.
Declared In
ADBannerView.h

bannerViewActionDidFinish:

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

- (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.

Availability
  • Available in iOS 4.0 and later.
Declared In
ADBannerView.h

bannerViewActionShouldBegin:willLeaveApplication:

Called before a banner view executes an action.

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

The banner view that the user tapped.

willLeave

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

Return Value

Your delegate returns YES if the banner action should execute; NO 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 YES. To suppress the action, return NO. 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 YES, 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 NO, 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.

Availability
  • Available in iOS 4.0 and later.
Declared In
ADBannerView.h

bannerViewDidLoadAd:

Called when a new banner advertisement is loaded.

- (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.

Availability
  • Available in iOS 4.0 and later.
Declared In
ADBannerView.h

bannerViewWillLoadAd:

Called before a new banner advertisement is loaded.

- (void)bannerViewWillLoadAd:(ADBannerView *)banner
Parameters
banner

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

Availability
  • Available in iOS 5.0 and later.
Declared In
ADBannerView.h