Integrating Full Screen Overlay Ad - adform/adform-ios-sdk GitHub Wiki
It is very easy to display overlay ads with Adform Advertising SDK. You just need to initialize AFAdOverlay
object and display it.
You just need to call showFromViewController:
method on AFAdOverlay
object and it will handle everything. First, it will load the ad and then display it to the user. It is important that you must retain the AFAdOverlay object, otherwise, ARC is going to release it before the ads are loaded.
Swift
...
//First, you need to create a property to retain the AFAdOverlay object.
private var overlayAd: AFAdOverlay?
...
override func viewDidLoad() {
super.viewDidLoad()
//Second, initialize AFAdOverlay.
overlayAd = AFAdOverlay(masterTagID: MasterTagID)
//Third, start ad loading.
overlayAd?.show(from: self)
}
Objective-C
...
//First, you need to create a property or an instance variable to retain the AFAdOverlay object.
@property (nonatomic, strong) AFAdOverlay *overlayAd;
...
- (void)viewDidLoad {
[super viewDidLoad];
//Second, initialize AFAdOverlay.
self.overlayAd = [[AFAdOverlay alloc] initWithMasterTagID:MasterTagID];
//Third, start ad loading.
[self.overlayAd showFromViewController:self];
}
That's it, your application can now display overlay ads.
For a complete example of how to integrate Adform full-screen overlay ads into your application, check out the sample app.