2014-04-17 3 views
0

에 말게을 숨길 수 :어떻게 AppDelegate.m에 배너를 볼 수있는 코드가 있습니다적인 Cocos2D

내가 GameLayerView에 배너를 숨길 수있는 방법
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone && [UIScreen mainScreen].bounds.size.height == 960.){ 
    bannerView = [[ADBannerView alloc]initWithFrame: 
        CGRectMake(0, 25, 320, 80)]; 
} 
else{ 
     bannerView = [[ADBannerView alloc]initWithFrame: 
         CGRectMake(0, 25, 320, 80)]; 
     // Optional to set background color to clear color 
     [bannerView setBackgroundColor:[UIColor clearColor]]; 
     [viewController.view addSubview: bannerView]; 

} 

? 그리고 나서 게임 오버 후 갓 나온다. GameLayer.m에 뭔가 써야할까요?

답변

0

이 같은 것을 수행하여 광고를 숨길 수 있습니다 :

-(void)hideBannerView{ 

    if (!_adBannerViewIsVisible){ 
     return; 
    } 

    if (bannerView){ 
     _adBannerViewIsVisible = false; 

     [UIView beginAnimations:nil context:nil]; 
     [UIView setAnimationDuration:0.5]; 
     [UIView setAnimationCurve:UIViewAnimationCurveEaseOut]; 

     CGRect frame = bannerView.frame; 

     frame.origin.x = 0.0f; 
     frame.origin.y = -bannerView.frame.size.height ; 

     bannerView.frame = frame; 

     [UIView commitAnimations]; 
    } 
} 

그냥 아마 헤더 파일, 어딘가 BOOL 변수 _adBannerViewIsVisible을하는 것을 잊지 마세요. 광고를 숨기려면 [self hideBannerView]으로 전화하십시오.