我终于让iAd工作了,我将如何制作这样的广告不会出现在我的游戏场景中?
这是我的iAds代码
- (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;
}
答案 0 :(得分:0)
即使场景已更改,也要停止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];
}
感谢LearnCocos2d