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