UISplitViewController - 如何在顶部添加视图?
我想在 UISplitViewController 的顶部添加一个视图控制器,以便我可以在 splitview 的两个视图上放置一个水平 iAd iPad 横幅。
这可能吗?它必须是一个 uiviewcontroller 才能使 ADBannerView 满意。
I want to add a view controller over the top of a UISplitViewController so that I can sit a horizontal iAd iPad banner across both views in the splitview.
Is this possible? It has to be a uiviewcontroller for the ADBannerView to be happy.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我知道这个问题已经有近2年历史了,但是我在苹果示例中找到了这个问题的解决方案:
在这里您可以找到 SplitViewBanner 示例,该示例展示了如何将 ADBannerView 和 UISplitViewController 添加到另一个视图控制器。
I know that this question is almost 2 years old, but I have found on apple examples the solution for this problem:
Here you can find the SplitViewBanner example that shows how to add a ADBannerView and a UISplitViewController to another view controller.
是的,这应该是可能的。这不是最干净的方法,但我在
keyWindow
中添加了一个view
,如下所示:[[[UIApplication sharedApplication] keyWindow] addSubview:someView];
。这保证了它将成为最顶层的视图。另一件需要考虑的事情是更改
UISplitViewController
的frame
。使其高度足以容纳下面的ADBannerView
。Yes, this should be possible. This isn't the cleanest way but I have added a
view
to thekeyWindow
, like this:[[[UIApplication sharedApplication] keyWindow] addSubview:someView];
. This guarantees that it'll be the top-most view.Another thing to consider is changing the
frame
of theUISplitViewController
. Make it just tall enough to fit anADBannerView
underneath.我认为苹果已将所有示例移至 此处。
另外,我在 AdBannerView 类参考中发现了更简单的代码来处理不适合视图的 AdBanner:
I think Apple have moved all their examples to here.
Also, I found this much simpler code in the AdBannerView Class Reference to deal with AdBanners that don't fit the view: