我正在尝试在我现有的某个应用中实施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];
}
答案 0 :(得分:1)
可能,当显示iad时,您可以打开modalView控制器或其他视图。这可能会导致模糊的错误。
消除错误的最简单方法是删除ViewWillDisappear中的横幅视图:
-(void)viewWillDisappear:(BOOL)animated
{
[bannerView removeFromSuperview];
}
答案 1 :(得分:0)
尝试添加[self.view bringSubviewToFront:bannerView];