iAd 警告 - 横幅视图被遮挡
我正在尝试在我现有的应用程序之一中实施 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
可能的是,当iad正在显示时,您在前面打开了一个modalView控制器或其他视图。这可能会导致模糊错误。
消除错误的最简单方法是删除 ViewWillDisappear 中的横幅视图:
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:
尝试添加
[self.view BringSubviewToFront:bannerView];
Try adding
[self.view bringSubviewToFront:bannerView];