Initialization
To display an interstitial ad in your app, create an instance of the MTRGInterstitialAd class. You must specify your slotId when creating an instance.
@interface YourViewController : UIViewController@end@implementation YourViewController{ MTRGInterstitialAd *_ad;}- (void)initAd{ // Enabling debug mode // [MTRGManager setDebugMode:YES]; // Create an instance of MTRGInterstitialAd _ad = [MTRGInterstitialAd interstitialAdWithSlotId:YOUR_SLOT_ID];}
Loading ads
To receive notifications (such as ad load succeeded, ad load failed, or ad clicked), you must set a delegate, which implements the MTRGInterstitialAdDelegate protocol, on the MTRGInterstitialAd instance. Then you can start loading ad.
@interface YourViewController : UIViewController <MTRGInterstitialAdDelegate>@end@implementation YourViewController{ MTRGInterstitialAd *_ad;}- (void)initAd{ // Create an instance of MTRGInterstitialAd _ad = [MTRGInterstitialAd interstitialAdWithSlotId:YOUR_SLOT_ID]; // Set the delegate _ad.delegate = self; // Start loading ad [_ad load];} - (void)onLoadWithInterstitialAd:(MTRGInterstitialAd *)interstitialAd{} - (void)onNoAdWithReason:(NSString *)reason interstitialAd:(MTRGInterstitialAd *)interstitialAd{} - (void)onDisplayWithInterstitialAd:(MTRGInterstitialAd *)interstitialAd{}- (void)onClickWithInterstitialAd:(MTRGInterstitialAd *)interstitialAd{}- (void)onCloseWithInterstitialAd:(MTRGInterstitialAd *)interstitialAd{}- (void)onLeaveApplicationWithInterstitialAd:(MTRGInterstitialAd *)interstitialAd{}
Displaying ads
After the ad has loaded successfully, you can start displaying interstitial ad.
- (void)onLoadWithInterstitialAd:(MTRGInterstitialAd *)interstitialAd{ [_ad showWithController:self];}