2014-02-17 56 views
0

我終於有iAds工作,我將如何使廣告不顯示在我的遊戲場景?禁用iAds在不同的場景Cocos2d 3.0

這是我的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

遊戲現場啓動時刪除adview – LearnCocos2D

+0

我將使用哪些代碼將其刪除? – Crazycriss

+1

許多選項之一:[_adView removeFromSuperview] – LearnCocos2D

回答

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