UISplitViewController - How to add a view over the top?
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];
精彩评论