UISplitViewController - 如何在顶部添加视图?

发布于 2024-10-09 22:08:24 字数 146 浏览 0 评论 0原文

我想在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

白云不回头 2024-10-16 22:08:24

我知道这个问题已经有近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.

只想待在家 2024-10-16 22:08:24

是的,这应该是可能的。这不是最干净的方法,但我在 keyWindow 中添加了一个 view ,如下所示: [[[UIApplication sharedApplication] keyWindow] addSubview:someView];。这保证了它将成为最顶层的视图。

另一件需要考虑的事情是更改 UISplitViewControllerframe。使其高度足以容纳下面的 ADBannerView

Yes, this should be possible. This isn't the cleanest way but I have added a view to the keyWindow, 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 the UISplitViewController. Make it just tall enough to fit an ADBannerView underneath.

渡你暖光 2024-10-16 22:08:24

我认为苹果已将所有示例移至 此处

另外,我在 AdBannerView 类参考中发现了更简单的代码来处理不适合视图的 AdBanner:

ADBannerView *myBannerView = <#Get a banner view#>;
UIView *myContainingView = <#Get the containing view#>;
NSSize newBannerSize = [myBannerView sizeThatFits:myContainingView];
[myBannerView setBounds:newBannerSize];

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:

ADBannerView *myBannerView = <#Get a banner view#>;
UIView *myContainingView = <#Get the containing view#>;
NSSize newBannerSize = [myBannerView sizeThatFits:myContainingView];
[myBannerView setBounds:newBannerSize];
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文