我看过其他问题,但它们似乎没有帮助......
我的标签栏应用程序中的一个 View Controller 的底部有一个 iAd 横幅。 我想在没有广告时隐藏它,但在有广告时显示它。
这是我在 View Controller 中打开或关闭它的代码,基于 Apple 的示例:
- (void)configureAdAnimated:(BOOL)animated
{
CGRect viewFrame = self.mainView.frame;
CGRect bannerFrame = adBannerView.frame;
self.adBannerView.currentContentSizeIdentifier = ADBannerContentSizeIdentifierPortrait;
if (adBannerView.bannerLoaded) {
viewFrame.size.height -= adBannerView.frame.size.height;
bannerFrame.origin.y = viewFrame.size.height;
self.adIsVisible = YES;
}
else {
bannerFrame.origin.y = viewFrame.size.height + bannerFrame.origin.y;
self.adIsVisible = NO;
}
[UIView animateWithDuration:animated ? 0.25 : 0.0 animations:^{
self.mainView.frame = viewFrame;
[self.mainView layoutIfNeeded];
adBannerView.frame = bannerFrame;
}];
}
它时不时地抛出随机错误(有些未知,有些像“广告库存不可用”等),并且在必要时它会消失,但当它出现时我无法点击它并且那里其上方有一个黑色空间,如下所示:
我已经设置了当前内容大小标识符、委托(delegate)(= self)等。
我应该怎么做才能让它发挥作用? 如果您需要更多代码、更多信息等,请告诉我。 谢谢!
最佳答案
尝试通过在单 View 应用程序而不是选项卡式布局中实现 iAd 来简化调试。
请注意,黑色空间的大小与 iAd 的大小相同。这应该可以让您了解正在发生的事情。
关于ios - 按下横幅时 iAd 不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14104546/