Using the SDK
Interstitials
Interstitial is an ad shown in full-screen, with the option to close it. Add the following lines to the ViewController.h file:
#import <TappxFramework/TappxAds.h>
@interface ViewController : UIViewController <TappxInterstitialViewControllerDelegate>
@property (retain, nonatomic) TappxInterstitialViewController* tappxInterstitial;
@end
Now you need to initialize the Interstitial in the ViewController.m file. Example:
#import "ViewController.h"
#import <TappxFramework/TappxAds.h>
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
_tappxInterstitial = [[TappxInterstitialViewController alloc] initWithDelegate:self];
[_tappxInterstitial setAutoShowWhenReady:YES];
[_tappxInterstitial load];
}
-(UIViewController*)presentViewController{
return self;
}
@end
If you want to request an interstitial to be shown as soon as it's ready, you can use this method:
[_tappxInterstitial setAutoShowWhenReady:YES];
If you want to have more control, you can use the following three options: load, isReady and show.
load is the request to get the ad and load all the information so you can show the ad.
[_tappxInterstitial load];
isReady allows you to check if the ad is ready to be shown. You will receive a "true" if the ad is ready and a "false" if not.
[_tappxInterstitial isReady];
show allows you to display the interstitial ad that has loaded previously.
[_tappxInterstitial show];
Delegates
You can add listener events into the Interstitial to be notified when a specific event happens in the ad. Here you have examples:
-(void) tappxInterstitialViewControllerDidFinishLoad:(TappxInterstitialViewController*) viewController{
NSLog(@"INTERSTITIAL: FinishLoad");
}
-(void) tappxInterstitialViewControllerDidFail:(TappxInterstitialViewController*) viewController
withError:(TappxErrorAd*) error{
NSLog(@"INTERSTITIAL: DidFail %@", error.descriptionError);
}
-(void) tappxInterstitialViewControllerDidPress:(TappxInterstitialViewController*) viewController{
NSLog(@"INTERSTITIAL: DidPress");
}
-(void) tappxInterstitialViewControllerDidClose:(TappxInterstitialViewController*) viewController{
NSLog(@"INTERSTITIAL: DidClose");
}
-(void) tappxInterstitialViewControllerDidAppear:(TappxInterstitialViewController*) viewController{
NSLog(@"INTERSTITIAL: DidAppear");