Cocos2d iphone 在不同场景中禁用IAD Cocos2d 3.0
我终于有了网络广告,我该怎么做才能让广告不出现在我的游戏场景中呢 这是我的iAds代码Cocos2d iphone 在不同场景中禁用IAD Cocos2d 3.0,cocos2d-iphone,iad,Cocos2d Iphone,Iad,我终于有了网络广告,我该怎么做才能让广告不出现在我的游戏场景中呢 这是我的iAds代码 - (id)init { { if ([ADBannerView instancesRespondToSelector:@selector(initWithAdType:)]) { _adView = [[ADBannerView alloc] initWithAdType:ADAdTypeBanner]; } else { _adView = [[ADBan
- (id)init
{
{
if ([ADBannerView instancesRespondToSelector:@selector(initWithAdType:)]) {
_adView = [[ADBannerView alloc] initWithAdType:ADAdTypeBanner];
} else {
_adView = [[ADBannerView alloc] init];
}
_adView.requiredContentSizeIdentifiers = [NSSet setWithObject:ADBannerContentSizeIdentifierPortrait];
_adView.currentContentSizeIdentifier = ADBannerContentSizeIdentifierPortrait;
[[[CCDirector sharedDirector]view]addSubview:_adView];
[_adView setBackgroundColor:[UIColor clearColor]];
[[[CCDirector sharedDirector]view]addSubview:_adView];
_adView.delegate = self;
}
return self;
}
要阻止iAd在场景已更改的情况下仍保留,请添加
[_adView removeFromSuperview]
将场景更改为如下所示的位置
- (void)onscoreButtonClicked:(id)sender
{
// start spinning scene with transition
[[CCDirector sharedDirector] replaceScene:[HighScoreScene scene]
withTransition:[CCTransition transitionPushWithDirection:CCTransitionDirectionUp duration:1.0f]];
[_adView removeFromSuperview];
}
感谢您学习ncocos2d在游戏场景启动时删除adview我将使用什么代码删除它?许多选项之一:[[u adview removeFromSuperview]