ADInterstitialAd Class Reference

Inherits from
Conforms to
Framework
/System/Library/Frameworks/iAd.framework
Availability
Available in iOS 4.3 and later.
Companion guide
Declared in
ADInterstitialAd.h
Related sample code

Overview

The ADInterstitialAd class provides full-screen advertisements that your iPad application can display to the user. When the user taps a full-screen advertisement, the advertisement launches a full-screen ad with rich media and interactive capabilities. Your application is notified when the advertisement is launched, but does not otherwise interact with the ad. You receive revenue when users view the advertisements or interact with the advertisements displayed by your application.

To use a full-screen ad in your application, instantiate a new ADInterstitialAd object and set its delegate; your delegate is called when the ad finishes loading its content from the iAd network. Each full-screen ad only loads a single advertisement during its lifetime; each time your application wants to display a new advertisement, it must create a new ADInterstitialAd object.

After your ad object loads its content, your application can display the ad in one of two ways. To display the content modally, your application presents by calling the ad object’s presentFromViewController: method, passing in a view controller to display the content. A modal advertisement interrupts the flow of control, requiring the user to either interact with the ad or explicitly close it before the application completes the user’s current task. Alternatively, your application can create a full-screen view and call the ad object’s presentInView: method to host the advertisement in that view. A view-based advertisement is almost always added as a subview to a UIScrollView object; this allows the advertisement to be scrolled on and off the screen alongside other pages of content provided by your application.

Regardless of how your application displays the full-screen advertisement, users interact with the advertisement by tapping on it. When a user taps the advertisement, your delegate’s interstitialAdActionShouldBegin:willLeaveApplication: is called to pause your application’s actives, after which the ad downloads the rich media experience from the iAd network and displays it to the user. After the user finishes interacting with the ad, the delegate’s interstitialAdActionDidFinish: method is called to complete the action.

After an advertisement expires, it is automatically removed from the screen. The ad object calls the delegate’s interstitialAdDidUnload: method to notify your application that the advertisement is no longer being displayed. At a minimum, your application should release the ad object, but your application may want to perform additional cleanup tasks. For example, if your application created a view to display the advertisement, it may want to remove that view from the view hierarchy or provide new content to be displayed in that view.

Subclassing Notes

The ADInterstitialAd class may not be subclassed.

Tasks

Setting and Getting the Delegate

Determining If an Interstitial Ad Has Loaded

Presenting an Advertisement

Handling Ad Actions

Properties

actionInProgress

A Boolean value that states whether the ad is currently executing an action. (read-only)

@property(nonatomic, readonly, getter=isActionInProgress) BOOL actionInProgress
Discussion

When the user taps on the ad, the advertisement triggers an action, displaying a media rich, interactive advertisement to the user. The value of this property is YES when an advertisement controls the screen, otherwise the value of this property is NO.

Your application should avoid polling this property to determine when an action starts or stops. Instead, implement the delegate methods to detect when actions begin or end.

Availability
  • Available in iOS 4.3 and later.
Declared In
ADInterstitialAd.h

delegate

The delegate of the interstitial ad object.

@property(nonatomic, assign) id<ADInterstitialAdDelegate> delegate
Discussion

Your application sets a delegate to be notified when the state of the ad object changes.

Availability
  • Available in iOS 4.3 and later.
Related Sample Code
Declared In
ADInterstitialAd.h

loaded

A Boolean value that states whether the interstitial ad object has downloaded an advertisement. (read-only)

@property(nonatomic, readonly, getter=isLoaded) BOOL loaded
Discussion

After your application creates an ad object, it automatically downloads content from the iAd Network. The value of this property is YES if the ad object has finished loading advertising content, otherwise the value of this property is NO. Do not poll the value of this property to determine whether an advertisement has been loaded; instead, implement the delegate’s interstitialAdDidLoad: method.

Availability
  • Available in iOS 4.3 and later.
Related Sample Code
Declared In
ADInterstitialAd.h

Instance Methods

cancelAction

Cancels an executing advertisement.

- (void)cancelAction
Discussion

An advertisement that is executing on top of your application completely covers your application’s user interface, but your application continues to run. If your application receives an event that requires the user’s attention, it can programmatically cancel the advertisement so that its normal interface is restored. The ad’s delegate is not called when your application cancels the action; your application is expected to restart any services it paused before the action began executing.

Canceling actions removes the advertisement from being displayed; frequently canceling advertisements can affect the revenue you earn from using advertisements in your application.

Availability
  • Available in iOS 4.3 and later.
Declared In
ADInterstitialAd.h

presentInView:

Displays the advertisement within an application view.

- (BOOL)presentInView:(UIView *)containerView
Parameters
containerView

A screen sized view provided by your application to hold the ad.

Return Value

YES if the ad was added successfully, otherwise NO.

Discussion

Your application presents a full-screen advertisement in a view when it wants the advertisement to be displayed seamlessly alongside other content, such as in a magazine layout. Typically the view is added as a subview of a scroll view configured to display its contents on page boundaries. An advertisement presented by a view expires after a period of 5 to 15 minutes. If the advertisement was offscreen when it expired, it is immediately unloaded from memory; otherwise, the advertisement is unloaded as soon as it moves offscreen.

An ad object throws an exception if your application presents the ad before it finishes loading content from the iAd Network.

The view passed into this method must be part of a view hierarchy managed by a view controller and must be large enough to accomodate the advertisement’s contents. The width of the view must be exactly the width of the screen. The height of the view may be up to 113 pixels shorter than the height of the screen. If your view’s size does not meet these requirements, the method returns NO to your application, and the advertisement is not added to the view. See iOS Human Interface Guidelines for more information.

While your view is displaying an advertisement, the advertisement completely covers any other content in the view. When the ad’s contents are unloaded, the advertisement is automatically removed from your view.

Availability
  • Available in iOS 4.3 and later.
Declared In
ADInterstitialAd.h