ADBannerView Class Reference
| Inherits from | |
| Conforms to | |
| Framework | /System/Library/Frameworks/iAd.framework |
| Availability | Available in iOS 4.0 and later. |
| Companion guide | |
| Declared in | ADBannerView.h ADBannerView_Deprecated.h |
Overview
The ADBannerView class provides a view that displays banner advertisements to the user. When the user taps a banner view, the view triggers an action programmed into the advertisement. For example, an advertisement might show a movie, present a modal advertisement, or launch Safari to show a webpage. Your application is notified when an action starts and stops, but does not otherwise interact with the advertisement. You receive revenue when users see new advertisements or trigger their actions.
The banner view’s delegate is called when a banner view cycles to show a new advertisement as well as when the user interacts with the banner view. For example, your delegate typically pauses your application’s activities when a user taps an advertisement and restores those activities when the user finishes interacting with the advertisement.
A banner view must always use one of the standard sizes defined in “Content Size Identifiers.” This is to ensure that the advertisement is drawn correctly. You configure the banner view’s requiredContentSizeIdentifiers property with the set of possible sizes your view is allowed to use in your application. To change the size of the banner view, do not set the bounds directly; instead set the currentContentSizeIdentifier property to one of the size identifiers included in that set. You can retrieve the actual dimensions that a particular identifier equates to on a specific device by calling the sizeFromBannerContentSizeIdentifier: class method.
Subclassing Notes
The ADBannerView class provides a self-contained view. Your application should not subclass ADBannerView, nor should your application attempt to change the behavior of the banner view. For example, your application should never add subviews to a banner view.
Tasks
Setting and Getting the Delegate
-
delegateproperty
Configuring the Advertising Shown in a Banner View
-
advertisingSectionproperty -
requiredContentSizeIdentifiersproperty Deprecated in iOS 6.0
Resizing a Banner View
-
currentContentSizeIdentifierproperty Deprecated in iOS 6.0 -
+ sizeFromBannerContentSizeIdentifier:Deprecated in iOS 6.0
Determining If a Banner View Is Showing an Advertisement
-
bannerLoadedproperty
Banner Actions
Properties
advertisingSection
Reserved for future use.
Discussion
This property is reserved for future use.
Availability
- Available in iOS 4.0 and later.
Declared In
ADBannerView.hbannerLoaded
A Boolean value that states whether the banner view has downloaded an advertisement. (read-only)
Discussion
Banner views automatically download new advertisements in the background. This property returns YES if an advertisement is loaded; NO otherwise.
Availability
- Available in iOS 4.0 and later.
Declared In
ADBannerView.hbannerViewActionInProgress
A Boolean value that states whether the banner is currently executing an user-triggered action. (read-only)
Discussion
Advertisements have an action that is triggered when the user taps the banner. Some actions remain in the application, covering the application’s user interface until the action completes. The value of this property is YES when such an action is running; otherwise it is NO.
Your application should avoid polling this property. Instead, implement the delegate methods to detect when an action begins or ends.
Availability
- Available in iOS 4.0 and later.
Declared In
ADBannerView.hdelegate
The delegate of the banner view.
Discussion
Availability
- Available in iOS 4.0 and later.
Declared In
ADBannerView.hInstance Methods
cancelBannerViewAction
Cancels an executing banner view action.
Discussion
A banner view action can cover your application’s user interface. However, your application continues to run, and receives events normally. If your application receives an event that requires the user’s attention, it can programmatically cancel the action and uncover its interface by calling cancelBannerViewAction. Canceling actions frequently can cause a loss of revenue for your application.
Availability
- Available in iOS 4.0 and later.
Declared In
ADBannerView.hConstants
Content Size Identifiers
These strings are used to identify the size of an advertisement.
extern NSString * const ADBannerContentSizeIdentifier320x50; extern NSString * const ADBannerContentSizeIdentifier480x32; extern NSString * const ADBannerContentSizeIdentifierPortrait; extern NSString * const ADBannerContentSizeIdentifierLandscape;
Constants
ADBannerContentSizeIdentifier320x50Indicates that the banner view is 320 points by 50 points in size. This size is used on iPhone for portrait advertisements. (Deprecated. Use
ADBannerContentSizeIdentifierPortraitinstead.)Available in iOS 4.0 and later.
Deprecated in iOS 4.2.
Declared in
ADBannerView_Deprecated.h.ADBannerContentSizeIdentifier480x32Indicates that the banner view is 480 points by 32 points in size. This size is used on iPhone for landscape advertisements. (Deprecated. Use
ADBannerContentSizeIdentifierLandscapeinstead.)Available in iOS 4.0 and later.
Deprecated in iOS 4.2.
Declared in
ADBannerView_Deprecated.h.ADBannerContentSizeIdentifierPortraitIndicates that the banner view is in portait mode. The exact size of the portait view is dependent on the iOS device the advertisement is displayed on. On iPhone, a portrait banner is 320 points by 50 points in size. On iPad, a portrait banner is 768 points by 66 points in size.
Available in iOS 4.2 and later.
Deprecated in iOS 6.0.
Declared in
ADBannerView_Deprecated.h.ADBannerContentSizeIdentifierLandscapeIndicates that the banner view is in landscape mode. The exact size of the view is dependent on the iOS device the advertisement is displayed on. On iPhone, a landscape banner is 480 points by 32 points in size. On iPad, a landscape banner is 1024 points by 66 points in size.
Available in iOS 4.2 and later.
Deprecated in iOS 6.0.
Declared in
ADBannerView_Deprecated.h.
ADErrorDomain
This constant defines the iAd framework error domain.
extern NSString * const ADErrorDomain;
Constants
ADErrorDomainIndicates an error occurred in iAd.
Available in iOS 4.0 and later.
Declared in
ADBannerView.h.
ADError
Error codes for the iAd error domain.
enum {
ADErrorUnknown = 0,
ADErrorServerFailure = 1,
ADErrorLoadingThrottled = 2,
ADErrorInventoryUnavailable = 3,
ADErrorConfigurationError = 4,
ADErrorBannerVisibleWithoutContent = 5,
ADErrorApplicationInactive = 6
};
typedef NSUInteger ADError;
Constants
ADErrorUnknownIndicates that an unknown or unexpected error occurred.
Available in iOS 4.0 and later.
Declared in
ADBannerView.h.ADErrorServerFailureIndicates that the connection to the advertisements server failed.
Available in iOS 4.0 and later.
Declared in
ADBannerView.h.ADErrorLoadingThrottledIndicates that the download from the advertisements server is currently being throttled.
Available in iOS 4.0 and later.
Declared in
ADBannerView.h.ADErrorInventoryUnavailableIndicates that no advertisements are currently available to download.
Available in iOS 4.0 and later.
Declared in
ADBannerView.h.ADErrorConfigurationErrorIndicates that your application has not been configured to receive advertisements. Check your application’s configuration on iTunes Connect. This error is not received when your application is running in Sandbox.
Available in iOS 4.1 and later.
Declared in
ADBannerView.h.ADErrorBannerVisibleWithoutContentIndicates that the banner is visible, but no advertisement is shown. Your application must always hide the banner when it does not have an advertisement to display.
Available in iOS 4.1 and later.
Declared in
ADBannerView.h.ADErrorApplicationInactiveIndicates that ad content is not available because the application is not currently active.
Available in iOS 4.3 and later.
Declared in
ADBannerView.h.
Availability
- Available in iOS 4.0 and later.
Declared In
ADBannerView.h© 2011 Apple Inc. All Rights Reserved. (Last updated: 2011-01-05)