Information on NADInterstital - fan-ADN/nendSDK-iOS GitHub Wiki
@property (nonatomic, weak, readwrite) id<NADInterstitialLoadingDelegate> loadingDelegate;
Assigning delegate Object (Optional)
@property (nonatomic, weak, readwrite) id<NADInterstitialClickDelegate> clickDelegate;
Assigning delegate Object (Optional)
@property (nonatomic) BOOL enableAutoReload;
Assigning auto reload after the ad is closed (optional)
Default:YES
- (instancetype)sharedInstance;
You will acquire and generate Instance.
- (void)loadAdWithSpotID:(NSInteger)spotID apiKey:(NSString *)apiKey;
Ad will start loading.
- (NADInterstitialShowResult)showAdFromViewController:(UIViewController*)viewController;
Ad will display by designating ViewController.
If there are multiple ads being loaded, the last ad that successfully loads will display.
If you will only use one interstitial ad space in the app, please use the following.
To set View Controller, it must be placed in the Root View Controller in the order of View Controller.
For more information regarding the order of View Controller, please refer to the View Controller Programming Guide for iOS.
- (NADInterstitialShowResult) showAdFromViewController:(UIViewController*)viewController spotID:(NSInteger)spotID;
AD will display when you assign View Controller and SpotID (that was issued from the dashboard).
- (BOOL)dismissAd;
Ad will not display (Return YES when the ad does not display.)
- (void)didFinishLoadInterstitialAdWithStatus:(NADInterstitialStatusCode)status;
We will notify the ad display result (optional).
- (void)didFinishLoadInterstitialAdWithStatus:(NADInterstitialStatusCode)status spotID:(NSInteger)spotID;
We will notify the spotID of the load result and targeted ad (optional).
- (void)didClickWithType:(NADInterstitialClickType)type;
We will notify the click event (optional).
- (void)didClickWithType:(NADInterstitialClickType)type spotID:(NSInteger)spotID;
We will notify the SpotID of the click event and targeted ad (optional).
Please refer to the sample code below regarding the argument of NADInterstitialStatusCode and NADInterstitialClickType.
Swift
import UIKit
import NendAd
class YourOriginalClass: UIViewController, NADInterstitialLoadingDelegate, NADInterstitialClickDelegate {
override func viewDidLoad() {
...
super.viewDidLoad()
NADInterstitial.sharedInstance().loadingDelegate = self
NADInterstitial.sharedInstance().clickDelegate = self
}
}Objective-C
#import <NendAd/NADInterstitial.h> // Import Header File
@interface YourOriginalClass() <NADInterstitialLoadingDelegate, NADInterstitialClickDelegate> // Conform NADInterstitialLoadingDelegate, NADInterstitialClickDelegate
@end
@implementation YourOriginalClass : UIViewController
- (void)initNADInterstitialSample
{
...
// Assign the class that implemnts NADInterstitialLoadingDelegate and NADInterstitialClickDelegate protocol to the delegate property
[NADInterstitial sharedInstance].loadingDelegate = self;
[NADInterstitial sharedInstance].clickDelegate = self;
}
...
@endSwift
func didFinishLoadInterstitialAd(withStatus status: NADInterstitialStatusCode) {
switch (status) {
case .SUCCESS:
print("Ad loaded successfully")
break
case .INVALID_RESPONSE_TYPE:
print("Invalid ad type")
break
case .FAILED_AD_REQUEST:
print("failed to request ad")
break
case .FAILED_AD_DOWNLOAD:
print("failed to load ad")
break
}
}Objective-C
- (void)didFinishLoadInterstitialAdWithStatus:(NADInterstitialStatusCode)status
{
switch (status) {
case SUCCESS:
NSLog(@"Ad loaded successfully");
break;
case INVALID_RESPONSE_TYPE:
NSLog(@"invalid ad type");
break;
case FAILED_AD_REQUEST:
NSLog(@"failed to request ad");
break;
case FAILED_AD_DOWNLOAD:
NSLog(@"failed to load ad");
break;
}
}Swift
func didFinishLoadInterstitialAd(withStatus status: NADInterstitialStatusCode, spotID: Int) {
// We will notify the load result by adding the ad spotID
switch (status) {
case .SUCCESS:
print("Ad loaded successfully")
break
case .INVALID_RESPONSE_TYPE:
print("Invalid ad type ")
break
case .FAILED_AD_REQUEST:
print("Failed to request ad")
break
case .FAILED_AD_DOWNLOAD:
print("Failed to load ad")
break
}
}Objective-C
- (void)didFinishLoadInterstitialAdWithStatus:(NADInterstitialStatusCode)status spotID:(NSInteger)spotID
{
// We will notify the load result by adding the ad spotID
switch (status) {
case SUCCESS:
NSLog(@"Ad loaded successfully");
break;
case INVALID_RESPONSE_TYPE:
NSLog(@"invalid ad type");
break;
case FAILED_AD_REQUEST:
NSLog(@"failed to request ad");
break;
case FAILED_AD_DOWNLOAD:
NSLog(@"failed to load ad ");
break;
}
}Swift
func didClick(with type: NADInterstitialClickType) {
switch (type) {
case .DOWNLOAD:
print("Download button was clicked ")
break
case .CLOSE:
print("Ad was closed")
break
case .INFORMATION:
print("Information button was clicked")
break
}
}Objective-C
- (void)didClickWithType:(NADInterstitialClickType)type
{
switch (type) {
case DOWNLOAD:
NSLog(@"Download button was clicked");
break;
case CLOSE:
NSLog(@"Ad was closed");
break;
case INFORMATION:
NSLog(@"Information button was clicked");
break;
}
}Swift
func didClick(with type: NADInterstitialClickType, spotID: Int) {
// We will notify the click event by adding the ad spotID
switch (type) {
case .DOWNLOAD:
print("Download button was clicked ")
break
case .CLOSE:
print("Ad was closed")
break
case .INFORMATION:
print("Information button was clicked ")
break
}
}Objective-C
- (void)didClickWithType:(NADInterstitialClickType)type spotID:(NSInteger)spotID
{
// We will notify the click event by adding the ad spotID
switch (type) {
case DOWNLOAD:
NSLog(@"Download button was clicked ");
break;
case CLOSE:
NSLog(@"Ad was closed ");
break;
case INFORMATION:
NSLog(@"Information button was clicked ");
break;
}
}