开发者

How to create UISplitViewController's portrait behavior in landscape orientations?

I'm trying to find a solution I've seen implemented in some iPad apps where what appears to be a UISplitViewController does not display the master view docked to the left in landscape orientation. Instead, the behavior is exactly the same in landscape as in portrait, with a UIBarButtonItem on the left side of a UIToolbar at the top of the screen bringing up a UIPopoverController with the master view controller's view. This presents some menu options that, when selected, appear to launch new UIViewController-derived classes into the detail view.

The app I'm working on needs to take advantage of as much screen real estate as possible and having the master view with the menu options docked to the left side doesn't add much value; it actually hinders the app.

So actually what I'm trying to do is two-fold:

  1. Suppress the docked master view in landscape orientation
  2. Have the selection of a row (menu option) in the master view load a new UIViewController-derived class into the detail view.

I've seen examples of each by themselves, respectively:

  1. http://vimeo.com/13054813 (Hiding the Root View of a UISplitViewController)
  2. http://bit.ly/aypcr0 (MultipleD开发者_运维问答etailViews code example from Apple)

However, I can't seem to get both of these working together.

The reason for using this approach is that I have multiple UIViewController-derived classes that I want to display when the appropriate menu option is selected. I could just instantiate them and add their views to the existing detail view and they would display fine. The problem is that none of the UIViewController lifecycle methods ever get called besides viewDidLoad (e.g. viewWillAppear:, viewDidUnload, etc.). This also includes orientation changes, and this is a big problem for the app. It seems that the only times a UIViewController-derived class acts like a UIViewController is when it is added as a subview of the app's UIWindow, or to a container class (like UINavigationController or UISplitViewController).

Am I going down the right path with the UISplitViewController, or is there a better solution?

Thanks for all of your help in advance!

Justin


This is a good UISplitViewController replacement that has the features you want (and more). It is a direct "drop in" replacement for the real UISplitViewConroller.

http://mattgemmell.com/2010/07/31/mgsplitviewcontroller-for-ipad

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜