(EN) iOS Interstitial - adxcorp/ADXLibrary_Integration GitHub Wiki
Interstitial Integration
1) Implementing Interstitial Ads
MyViewController.h
#import "MPInterstitialAdController.h"
@interface MyViewController : UIViewController <MPInterstitialAdControllerDelegate>
@property (nonatomic, retain) MPInterstitialAdController *interstitial;
@end
MyViewController.m
#import "MyViewController.h"
@implementation MyViewController
- (void)viewDidLoad {
[super viewDidLoad];
[self loadInterstitial];
}
- (void)loadInterstitial {
self.interstitial = [MPInterstitialAdController
interstitialAdControllerForAdUnitId:@"<YOUR_ADUNIT_ID_HERE>"];
[self.interstitial loadAd];
}
- (void)showAd {
if (self.interstitial.ready) {
[self.interstitial showFromViewController:self];
}
}
2) Receiving optional delegate callbacks
MPInterstitialAdControllerDelegate
provides various callbacks, such as when ad has been successfully loaded or when modal view is presented or dismissed. Please refer to callback methods that are found by looking at MPInterstitialAdControllerDelegate
protocol in MPInterstitialAdController.h
and use them appropriately to your needs.