2

我的 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];
    }];
}`
4

1 回答 1

4

在要添加 iAds 面板的视图的属性检查器上,在 Extend Edges 部分中选中 Under Bottom Bars 或 Under Opaque Bars。取消选中它们可能会解决您的问题。这些是 iOS 7 的新设置。

于 2013-10-09T10:30:48.517 回答