2011-10-31 2 views
1

방금 ​​내 앱에 ADBannerview를 추가했습니다. UIApplicationDelegate에서 UIApplicationDelegate에 AdBannerView를 만들어 하나의 인스턴스 만 있고 다른 viewController에서 공유합니다.내 AdBannerView를 숨기지 만 여전히 경고를받습니다. 배너보기 (0x9c75550)에 광고가 있습니다.

경고 메시지가 표시되지 않는 한 모든 것이 완벽하게 작동합니다. ADBannerView : 경고 배너보기 (0x9c75550)에 광고가 있습니다. 그러나 가려 질 수 있습니다. 이 메시지는 배너보기별로 한 번만 인쇄됩니다.

(presentModalViewController를 사용하여) 모달보기를 열면 현재 ADBannerview를 표시하는보기의 맨 위에 표시됩니다. 나는이 경고 메시지를 가지고 있지 위해 무엇을 이해하지

- (void)viewWillDisappear:(BOOL)animated 
{ 
    ADBannerView *bannerView = [ (ScoreBoardAppDelegate*)[[UIApplication sharedApplication] delegate] adBanner]; 
    [self hideBanner:bannerView]; 
    [super viewWillDisappear:animated]; 
} 

- (void)hideBanner:(ADBannerView*) adBanner { 
    NSLog(@"%s called", __FUNCTION__); 

    // Grow the tableview to occupy space left by banner, it's the size of the parent view 
    CGFloat fullViewHeight = self.tbView.frame.size.height; 
    CGRect tableFrame = self.tv.frame; 
    tableFrame.size.height = fullViewHeight; 

    // Move the banner view offscreen 
    CGRect bannerFrame = adBanner.frame; 

    CGRect screenBounds = [[UIScreen mainScreen] bounds]; 
    bannerFrame.origin = CGPointMake(CGRectGetMinX(screenBounds), CGRectGetMaxY(screenBounds)); 

    self.tv.frame = tableFrame; 
    adBanner.frame = bannerFrame; 
} 

: 모달보기를 열기 전에 나는 ADBannerview을 숨기려면 다음 코드를 사용하고 있습니다. 모달보기가 표시되기 전에 ADBannerView가 성공적으로 숨겨져있는 것 같습니다 (오프 스크린).

나는 아마 뭔가를 놓쳤지 만 나는 그것을 볼 수 없다. 도움을 주셔서 감사합니다.

세바스찬.

답변

1

세바스찬 (Sébastien), 나는 많은 시간 동안 질문에 답을 얻지 못했기 때문에이 질문에 대답하지 않았 으면 좋겠습니다. 최근에 iAd 지원을 추가했고이 경고가 너무 성가시다는 사실을 알았습니다. 광고 배너를 공유하는 미묘한 점 중 하나는 초기보기 컨트롤러에 표시하려는 경우 앱 대리인이 아닌 해당보기 컨트롤러에서 대부분의 설정을 수행해야한다는 것입니다. 내 초기 뷰 컨트롤러 메소드 :

- (void)viewWillAppear:(BOOL)animated { 
    [super viewWillAppear:animated]; 
    if (!SharedAdBannerView) { 
     // in my app, the ad banner is the bottom-most thing on screen 
     CGRect startingFrame = CGRectMake(0.0, self.view.frame.origin.y + self.view.frame.size.height, 320.0, 50.0); 
     adBanner = [[ADBannerView alloc] initWithFrame:startingFrame]; 

     // Set the autoresizing mask so that the banner is pinned to the bottom 
     adBanner.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleTopMargin; 

     // Since we support all orientations, support portrait and landscape content sizes. 
     // If you only supported landscape or portrait, you could remove the other from this set 
     adBanner.requiredContentSizeIdentifiers = [NSSet setWithObjects:ADBannerContentSizeIdentifierPortrait, nil]; 
     adBanner.currentContentSizeIdentifier = ADBannerContentSizeIdentifierPortrait; 

     adBanner.delegate = self; 
     [self.view addSubview:adBanner]; 
     SharedAdBannerView = adBanner; 
    } else { 
     adBanner = SharedAdBannerView; 
} 

SharedAdBannerView가 TN2286 항에 매크로이고, 어떻게이를 인 (앱 델리게이트 정의 인스턴스 변수를 이용되어

는 viewWillAppear이고 iAd를 표시하는 모든보기간에 공유 됨). 또한 하나의 장면이 다른 장면과 구별되기 때문에 뷰 계층 구조에서 제거하기 전에 화면에서 광고 배너를 움직이기로 결정했습니다. 나는 광고 배너가 뷰 계층 구조의 일부일 때마다 그 메시지를 얻을 것이라고 말하면서, 즉 배너 뷰를 숨기는 것이 경고 메시지를 방지하는 방법이 아니라는 것을 읽었다. 다르게 말하자면 광고 배너를 숨기기에 충분하다면 문제가 해결되지 않아 문제 해결에 도움이되지 않습니다. 내가 GDB에서이 팁을 제공하는 TN2239을 가로 질러 왔을 때 나는 많은 것을 배웠 : 당신은 당신이 당신의 중단 점을 배치 위치에 따라 recursiveDescription 메시지를 보낼 수 있지만, 누구에게 대상을 조정해야

po [[self view] recursiveDescription]; 

을 아마 [자기보기] 괜찮습니다.

+0

네, 저를 도왔습니다! – sebastien