开发者

UISplitViewController - How to add a view over the top?

开发者 https://www.devze.com 2023-02-01 15:33 出处:网络
I want to add a view controller over the top of a UISplitViewController so that I can sit a horizontal iAd iPad banner acr开发者_StackOverflow中文版oss both views in the splitview.

I want to add a view controller over the top of a UISplitViewController so that I can sit a horizontal iAd iPad banner acr开发者_StackOverflow中文版oss both views in the splitview.

Is this possible? It has to be a uiviewcontroller for the ADBannerView to be happy.


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.


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.


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];
0

精彩评论

暂无评论...
验证码 换一张
取 消