/1.11.1.0
@protocol MPAdViewDelegate <MPMoPubAdDelegate>
The delegate of an MPAdView
object must adopt the MPAdViewDelegate
protocol. It must implement viewControllerForPresentingModalView
to provide a root view controller from which the ad view should present modal content. Optional methods of this protocol allow the delegate to be notified of banner success or failure, as well as other lifecycle events.
Public Methods
Managing Modal Content Presentation
-/viewControllerForPresentingModalView /+1.11.1.0
-
Description: Asks the delegate for a view controller to use for presenting modal content, such as the in-app browser that can appear when an ad is tapped. Returns a view controller that should be used for presenting modal content.
-
Declaration:
- (UIViewController *)viewControllerForPresentingModalView;`
-
Parameters: None.
Detecting When a Banner Ad is Loaded
-/adViewDidLoadAd:adSize: /+5.10.0
-
Description: Sent when an ad view successfully loads an ad. Your implementation of this method should insert the ad view into the view hierarchy, if you have not already done so.
-
Declaration:
- (void)adViewDidLoadAd:(MPAdView *)view adSize:(CGSize)adSize;`
-
Parameters:
view
: The ad view sending the message.adSize
: The size of the ad that was successfully loaded. It is recommended to resize the MPAdView frame to match the height of the loaded ad.
-/adView:didFailToLoadAdWithError: /+1.11.1.0
-
Description: Sent when an ad view fails to load an ad. To avoid displaying blank ads, hide the ad view in response to this message.
-
Declaration:
- (void)adView:(MPAdView *)view didFailToLoadAdWithError:(NSError *)error;`
-
Parameters:
view
: The ad view sending the message.error
: The error.
Detecting When a User Interacts With the Ad View
-/willPresentModalViewForAd: /+1.11.1.0
-
Description: Sent when an ad view is about to present modal content. This method is called when the user taps on the ad view. Your implementation of this method should pause any application activity that requires user interaction. Refer to
didDismissModalViewForAd:
. -
Declaration:
- (void)willPresentModalViewForAd:(MPAdView *)view;`
-
Parameters:
view
: The ad view sending the message.
-/didDismissModalViewForAd: /+1.11.1.0
-
Description: Sent when an ad view has dismissed its modal content, returning control to your application. Your implementation of this method should resume any application activity that was paused in response to
willPresentModalViewForAd:
. -
Declaration:
- (void)(didDismiss)ModalViewForAd:(MPAdView *)view;`
-
Parameters:
view
: The ad view sending the message.
-/willLeaveApplicationFromAd: /+1.11.1.0
-
Description: Sent when a user is about to leave your application as a result of tapping on an ad. Your application will be moved to the background shortly after this method is called.
-
Declaration:
- (void)willLeaveApplicationFromAd:(MPAdView *)view;`
-
Parameters:
view
: The ad view sending the message.
Last updated December 03, 2020
TWITTER, MOPUB, and the Bird logo are trademarks of Twitter, Inc. or its affiliates. All third party logos and trademarks included are the property of their respective owners.
© 2020 MoPub (a division of Twitter, Inc.)