An interstitial is a full-screen ad that can be hidden by the user.
Create an interstitial adding your Tappx key and load the ad as per example below.
#import <TappxFramework/TappxAds.h>
@interface ViewController ()<TappxInterstitialAdDelegate>
@property (retain, nonatomic) TappxInterstitialAd* tappxInterstitial;
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
_tappxInterstitial = [[TappxInterstitialAd alloc] initWithDelegate:self];
[_tappxInterstitial setAutoShowWhenReady:YES];
[_tappxInterstitial load];
}
@end
import UIKit
import TappxFramework
class ViewController: UIViewController
{
var tappxInterstitial: TappxInterstitialAd?
override func viewDidLoad() {
super.viewDidLoad()
self.tappxInterstitial = TappxInterstitialAd(delegate: self)
self.tappxInterstitial?.setAutoShowWhenReady(enable: true)
self.tappxInterstitial?.load()
}
}
import SwiftUI
import TappxFramework
class ViewController: View{
var tappxInterstitial: TappxInterstitialAd!
override func viewDidLoad() {
super.viewDidLoad()
tappxInterstitial= TappxInterstitialAd(delegate: self)
tappxInterstitial?.setAutoShowWhenReady(enable: true)
tappxInterstitial.load()
}
}
Then request it and show it as soon as possible, using the setAutoShowWhenReady method.
[_tappxInterstitial setAutoShowWhenReady:YES];
self.tappxInterstitial?.setAutoShowWhenReady(enable: true)
self.tappxInterstitial?.setAutoShowWhenReady(enable: true)
To have more control over your interstitial ads, you can use load, isReady and show.
#import <TappxFramework/TappxAds.h>
@interface ViewController ()<TappxInterstitialAdDelegate>
@property (retain, nonatomic) TappxInterstitialAd* tappxInterstitial;
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
_tappxInterstitial = [[TappxInterstitialAd alloc] initWithDelegate:self];
[_tappxInterstitial setAutoShowWhenReady:NO];
[_tappxInterstitial load];
}
@end
import UIKit
import TappxFramework
class ViewController: UIViewController
{
var tappxInterstitial: TappxInterstitialAd?
override func viewDidLoad() {
super.viewDidLoad()
self.tappxInterstitial = TappxInterstitialAd(delegate: self)
self.tappxInterstitial?.setAutoShowWhenReady(enable: false)
self.tappxInterstitial?.load()
}
}
import SwiftUI
import TappxFramework
class ViewController: View{
var tappxInterstitial: TappxInterstitialAd!
override func viewDidLoad() {
super.viewDidLoad()
tappxInterstitial= TappxInterstitialAd(delegate: self)
tappxInterstitial?.setAutoShowWhenReady(enable: false)
tappxInterstitial.load()
}
}
load is the request to load the ad and all the information so you can show the ad when you need to.
[_tappxInterstitial load];
self.tappxInterstitial?.load()
self.tappxInterstitial?.load()
isReady lets you 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];
self.tappxInterstitial?.isReady()
self.tappxInterstitial?.isReady()
show lets you display the interstitial ad that has loaded previously.
[_tappxInterstitial show];
self.tappxInterstitial?.show()
self.tappxInterstitial?.show()
TIP: we also recommend sending additional information with your ad requests to improve performance. Check Advanced Settings section.
Use delegates methods to be notified when a specific event happens.
-(void) tappxInterstitialAdDidFinishLoad:(TappxInterstitialAd*) viewController{
NSLog(@"INTERSTITIAL: FinishLoad");
}
-(void) tappxInterstitialAdDidFail:(TappxInterstitialAd) viewController
withError:(TappxErrorAd) error{
NSLog(@"INTERSTITIAL: DidFail %@", error.descriptionError);
}
-(void) tappxInterstitialAdDidPress:(TappxInterstitialAd*) viewController{
NSLog(@"INTERSTITIAL: DidPress");
}
-(void) tappxInterstitialAdDidClose:(TappxInterstitialAd*) viewController{
NSLog(@"INTERSTITIAL: DidClose");
}
-(void) tappxInterstitialAdDidAppear:(TappxInterstitialAd*) viewController{
NSLog(@"INTERSTITIAL: DidAppear");
}
extension ViewController: TappxInterstitialAdDelegate {
public func tappxInterstitialAdDidFinishLoad(_viewController: TappxInterstitialAd!) {
print("INTERSTITIAL: FinishLoad")
}
public func tappxInterstitialAdDidFail(viewController: TappxInterstitialAd!, withError error: Error!) {
print("INTERSTITIAL: Failed %@", error.localizedDescription)
}
public func tappxInterstitialAdDidPress(_viewController: TappxInterstitialAd!) {
print("INTERSTITIAL: DidPress")
}
public func tappxInterstitialAdDidClose(_viewController: TappxInterstitialAd!) {
print("INTERSTITIAL: DidClose")
}
public func tappxInterstitialAdDidAppear(_viewController: TappxInterstitialAd!) {
print("INTERSTITIAL: DidAppear")
}
}
extension ViewController: TappxInterstitialAdDelegate {
public func tappxInterstitialAdDidFinishLoad(_viewController: TappxInterstitialAd!) {
print("INTERSTITIAL: FinishLoad")
}
public func tappxInterstitialAdDidFail(viewController: TappxInterstitialAd!, withError error: Error!) {
print("INTERSTITIAL: Failed %@", error.localizedDescription)
}
public func tappxInterstitialAdDidPress(_viewController: TappxInterstitialAd!) {
print("INTERSTITIAL: DidPress")
}
public func tappxInterstitialAdDidClose(_viewController: TappxInterstitialAd!) {
print("INTERSTITIAL: DidClose")
}
public func tappxInterstitialAdDidAppear(_viewController: TappxInterstitialAd!) {
print("INTERSTITIAL: DidAppear")
}
}
Interstitial ads example: Objective-C | Swift | SwiftUI
Complete demo: Objective-C | Swift | SwiftUI