Inherits from | UIView |
Conforms to | PMAdRenderer |
Declared in | PMBannerAdView.h PMBannerAdView.m |
Overview
Renders simple Banner and Rich media Ads.
Tasks
Initialization
- initWithFrame:
- delegate property
- loadRequest:
- updateInterval property
- useInternalBrowser property
- reset
- removeContent
- getAdSize
- isInternalBrowserOpen property
Properties
delegate
Sets the PMBannerAdViewDelegate delegate receiver for the ad view.
@property (nonatomic, weak) id<PMBannerAdViewDelegate> delegate
- Observe proper reference management when using delegates.
- Be sure to set the delegate to nil before setting the Banner Ad view’s object reference to nil.
PMBannerAdView.h
isInternalBrowserOpen
Returns the status of the internal browser.
@property (nonatomic, readonly) BOOL isInternalBrowserOpen
See Also
Declared In
PMBannerAdView.h
updateInterval
Time in seconds after which ad will udpated/refreshed.
@property (nonatomic) NSTimeInterval updateInterval
Discussion
By default a Banner Ad view does not auto-refresh. To enable auto-refresh, set updateInterval to a non-zero value; a valid value will be in the range of 12 to 120 seconds. The table below lists the Banner Ad auto-refresh behavior given updateInterval=X:
X <= 0 | Ad does not auto-refresh. |
X > 0 & X <= 12 | Ad auto-refreshes every 12 seconds. |
X > 12 & X <= 120 | Ad auto-refreshes every X seconds. |
X > 120 | Ad auto-refresh every 120 seconds. |
Warning: Set updateInterval before calling [PMBannerAdView loadRequest:].
Declared In
PMBannerAdView.h
useInternalBrowser
Set to YES to enable the internal browser to open ad content. Defaults to NO
.
See Also
Declared In
PMBannerAdView.h
Instance Methods
getAdSize
Get the ad size received in ad response.
- (CGSize)getAdSize
Warning: Ad size is availabe only after a successful Ad response; that is, when the bannerAdViewDidRecieveAd: delegate method is called.
Declared In
PMBannerAdView.h
initWithFrame:
Initilizes an inline instance of the ad view.
- (id)initWithFrame:(CGRect)frame
Parameters
- frame
- The area to place the view.
Discussion
Add the view to other views as you would with any other UIView object. The frame determines the size of the ad in the ad server request. If the frame size isn't known at initialization time, ensure that the view’s frame is set prior to calling [PMBannerAdView loadRequest:].
Declared In
PMBannerAdView.h
loadRequest:
Begins loading the ad request.
- (void)loadRequest:(PMBaseAdRequest *)adRequest
Declared In
PMBannerAdView.h
removeContent
Removes any displayed ad content and any associated state.
- (void)removeContent
Discussion
In addition to removing content and state, this method also:
- Collapses any expanded or resized richmedia ads.
- Cancels any deferred update.
Unlike reset, removeContent does not reset the instance to its default state.
Declared In
PMBannerAdView.h
reset
Resets the instance to its default state.
- (void)reset
Discussion
Performs the following to return the instance to its default state:
- Stops updates and cancels the update interval.
- Stops location detection.
- Collapses any expanded or resized richmedia ads.
- Closes internal ad browser.
Send reset before releasing the instance if another object such as a superview or list may be retaining it. This lets the app suspend ad updating and interaction to allow other app activities to occur.
- If your project is using ARC (automatic reference counting) reset must be called to cancel internal timers. If not, the main NSRunLoop will retain a reference to the PMBannerAdView instance and continue invoking its timers.
- The reset method does not reset the delegate.
PMBannerAdView.h