开发者

iAd Warning -- banner view obscured

I am attempting to implement iAd in one of my existing apps. It works, but I keep getting an error message: ADBannerView: WARNING A banner view has an ad but may be obscured. This message is only printed once per banner view.

Is the ad obscured or could be obscured? Is there something wrong with the code? I can't figure it out. I will admit to being a newbie. Any help would be greatly appreciated. Thank you for even looking at my question.

- (void)createBannerView {

        Class cls = NSClassFromString(@"ADBannerView");

    if (cls) {

        ADBannerView *adView = [[[cls alloc] initWithFrame:CGRectZero]autorelease];       

        adView.currentContentSizeIdentifier =ADBannerContentSizeIdentifierPortrait;

       adView.autoresizingMask =  UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleTopMargin |UIViewAutoresizingFlexibleBottomMargin| UIViewAutoresizingFlexibleRightMargin |UIViewAutoresizingFlexibleLeftMargin;

        adView.delegate = self;

        CGRect bannerFrame =adView.frame;

        bannerFrame.origin.y = self.view.frame.size.height;
            adView.frame = bannerFrame;

             adView.frame = CGRectOffset(adView.frame, 0, -50);


        self.bannerView = adView;

        [self.view addSubview:adView];


    }

}

- (void)showBanner {

    CGFloat fullViewHeight = self.view.frame.size.height;

    CGRec开发者_StackOverflowt tableFrame = self.tView.frame;

    CGRect bannerFrame = self.bannerView.frame;

    tableFrame.size.height = fullViewHeight - bannerFrame.size.height;

    bannerFrame.origin.y = fullViewHeight - bannerFrame.size.height; 

    [UIView beginAnimations:@"showBanner" context:NULL];

    self.tView.frame = tableFrame;

    self.bannerView.frame = bannerFrame;

    [UIView commitAnimations];

}


Possible, when iad is being displayed, you open a modalView controller or other views to front. this might lead to obscured error.

Easiest way to eliminate the error is, removing the banner view in ViewWillDisappear:

-(void)viewWillDisappear:(BOOL)animated
{
    [bannerView removeFromSuperview];
}


Try adding [self.view bringSubviewToFront:bannerView];

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜