我已经在我的应用中实现了admob横幅,现在我想要实施Intersitial广告。代码用Obj-C ++编写。以下是横幅的代码:
#import "MyGameBridge.h"
#import "AppController.h"
#import "GameConfig.h"
#include "GADInterstitial.h"
void MyGameBridge::showBanner()
{
AppController* delegate = (AppController*)[UIApplication sharedApplication].delegate;
[delegate openAdmobBannerAds];
}
void MyGameBridge::showAds()
{
AppController* delegate = (AppController*)[UIApplication sharedApplication].delegate;
[delegate initiAdBanner];
}
void MyGameBridge::hideAds()
{
AppController* delegate = (AppController*)[UIApplication sharedApplication].delegate;
[delegate hideBanner];
}
我需要编码以实施插页式广告?
答案 0 :(得分:0)
在.h文件中定义
GADInterstitial *mInterstitial_;
在.m文件中,
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
...
mInterstitial_ = [[GADInterstitial alloc] init];
mInterstitial_.adUnitID = ADMOB_FULL_SCREEM_ID;
[mInterstitial_ loadRequest:[GADRequest request]];
}
//使用以下功能调用admob interstitial
-(void)showAdmobAdsFullScreen
{
[mInterstitial_ presentFromRootViewController:self.viewController];
mInterstitial_ = nil;
mInterstitial_ = [[GADInterstitial alloc] init];
mInterstitial_.adUnitID = ADMOB_FULL_SCREEM_ID;
[mInterstitial_ loadRequest:[GADRequest request]];
}