【问题标题】:iAds showing underneath tab bar ibn iOS7在 iOS 7 的标签栏下方显示 iAd
【发布时间】:2013-09-27 16:51:32
【问题描述】:

我的 iOS 6 应用中的 iAd 运行良好,它们会出现在标签栏上方并且运行良好;但是在 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];
    }];
}`

【问题讨论】:

  • 介意向我们展示设置 iAd 的frame 的代码吗?发生这种情况的原因有很多...
  • 对不起,我已经添加了我的代码。非常感谢

标签: ios7 xcode5 iad tabbar tabbarcontroller


【解决方案1】:

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

【讨论】:

  • @KevinTarr 没问题。升级到 iOS7 后,我的 iOS 4 应用完全被此功能破坏。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-08-14
  • 2015-10-14
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多