iAd 警告 - 横幅视图被遮挡

发布于 2024-12-03 09:04:32 字数 1536 浏览 2 评论 0原文

我正在尝试在我现有的应用程序之一中实施 iAd。它有效,但我不断收到错误消息:ADBannerView:警告横幅视图有广告,但可能被遮挡。此消息仅在每个横幅视图中打印一次。

广告是否被遮挡或可能被遮挡?代码有问题吗?我想不通。我承认自己是个新手。任何帮助将不胜感激。谢谢你甚至看我的问题。

- (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;

    CGRect 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];

}

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;

    CGRect 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];

}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

把回忆走一遍 2024-12-10 09:04:32

可能的是,当iad正在显示时,您在前面打开了一个modalView控制器或其他视图。这可能会导致模糊错误。

消除错误的最简单方法是删除 ViewWillDisappear 中的横幅视图:

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

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];
}
韬韬不绝 2024-12-10 09:04:32

尝试添加 [self.view BringSubviewToFront:bannerView];

Try adding [self.view bringSubviewToFront:bannerView];

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文