我的 iAd 在我的 iOS 6 应用程序中运行良好,它们会出现在标签栏上方并且运行良好;但是在 iOS7 和 Xcode 5 中,我的广告出现在标签栏下方。我知道它会加载应用程序,因为我可以看到“bannerViewDidLoadAd”,并且标签栏顶部出现了一条非常确定的行。
我还下载了 Apple iAdSuite,标签栏的例子完全一样!
请任何人帮助解释为什么广告出现在标签栏下方而不是上方?
对不起,我设置框架的代码:
`- (void)viewDidLayoutSubviews
{
CGRect contentFrame = self.view.bounds, bannerFrame = CGRectZero;
ADBannerView *bannerView = [BannerViewManager sharedInstance].bannerView;
// If configured to support iOS >= 6.0 only, then we want to avoid
// currentContentSizeIdentifier as it is deprecated.
// Fortunately all we need to do is ask the banner for a size that fits into the layout
// area we are using. At this point in this method contentFrame=self.view.bounds,
// so we'll use that size for the layout.
//
bannerFrame.size = [bannerView sizeThatFits:contentFrame.size];
if (bannerView.bannerLoaded) {
contentFrame.size.height -= bannerFrame.size.height;
bannerFrame.origin.y = contentFrame.size.height;
} else {
bannerFrame.origin.y = contentFrame.size.height;
}
self.contentController.view.frame = contentFrame;
// We only want to modify the banner view itself if this view controller is actually
// visible to the user. This prevents us from modifying it while it is being displayed elsewhere.
//
if (self.isViewLoaded && (self.view.window != nil)) {
[self.view addSubview:bannerView];
bannerView.frame = bannerFrame;
}
[self.view layoutSubviews];
}
- (void)updateLayout
{
[UIView animateWithDuration:0.25 animations:^{
[self.view setNeedsLayout];
[self.view layoutIfNeeded];
}];
}`