iAd View 与自定义 ViewController
我尝试将 iAd 集成到我的应用程序中。
我有一个类 SwitchViewController (: UIViewController) ,它处理所有 自定义 ViewController 和我在此应用程序中拥有的视图。
当在最高 atIndex 添加如下视图时,出现错误:
ADBannerView: WARNING A banner view has an ad but may be obscured
但是,如果我不插入所有其他子视图 - iAd 工作正常。我可以看到它,但是 当然,所有其他观点都消失了。
有什么想法吗?
通过以下方式添加子视图:
ADBannerView *tmpBannerView = [[ADBannerView alloc] initWithFrame:CGRectZero];
self.adView_iPad = tmpBannerView;
self.adView_iPad.frame = CGRectMake(0, 0, self.adView_iPad.frame.size.width, self.adView_iPad.frame.size.height);
self.adView_iPad.requiredContentSizeIdentifiers = [NSSet setWithObject:ADBannerContentSizeIdentifierPortrait];
self.adView_iPad.currentContentSizeIdentifier = ADBannerContentSizeIdentifierPortrait;
self.adView_iPad.delegate = self;
[self.view insertSubview:self.adView_iPad atIndex:100];
I try to integrate iAd to my App.
I have a class SwitchViewController (: UIViewController) which deals with all the
custom ViewControllers & Views I have in this app.
When adding the View as below at the highest atIndex, I get an error:
ADBannerView: WARNING A banner view has an ad but may be obscured
However, if I do not insert all the other subviews - the iAd works fine. I can see it, but
of course all the other views are gone.
Any Ideas?
Adding the subview by:
ADBannerView *tmpBannerView = [[ADBannerView alloc] initWithFrame:CGRectZero];
self.adView_iPad = tmpBannerView;
self.adView_iPad.frame = CGRectMake(0, 0, self.adView_iPad.frame.size.width, self.adView_iPad.frame.size.height);
self.adView_iPad.requiredContentSizeIdentifiers = [NSSet setWithObject:ADBannerContentSizeIdentifierPortrait];
self.adView_iPad.currentContentSizeIdentifier = ADBannerContentSizeIdentifierPortrait;
self.adView_iPad.delegate = self;
[self.view insertSubview:self.adView_iPad atIndex:100];
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您始终希望确保 ADBannerView 是层次结构中的最顶层视图,以避免出现此警告。如果任何视图与它重叠,即使它具有透明度,您也会收到此警告。
你可以简单地做这样的事情。
更新:
设置视图大小时,最好查询类的大小。
这将返回您应该使用的高度和宽度。所以像这样设置框架:
You always want to make sure the ADBannerView is the topmost view in the hierarchy to avoid this warning. If any view overlaps it, even if it has transparency, you'll get this warning.
You can simply do something like this.
UPDATE:
When setting the view size, it is best to query the class for the size.
This will return the height and width that you should use. So set the frame like this: