UISplitViewController and complex view heirarchy

Posted by Jasconius on Stack Overflow See other posts from Stack Overflow or by Jasconius
Published on 2010-04-14T19:01:09Z Indexed on 2010/04/15 4:23 UTC
Read the original article Hit count: 878

I'm doing an iPad tech demo and I'm running into a serious technical problem.

I have an app concept that leverages UISplitViewController, but NOT as the primary controller for the entire app.

The app flow could be described roughly as this:

Home screen (UIViewController) List->Detail "Catalog" (UISplitViewController) Super Detail Screen (UIViewController but could conceivable also be a child of SplitView).

The problem is in the flow between Home and Catalog. Once a UISplitViewController view is added to the UIWindow, it starts to throw hissy fits.

The problem can be summarized at this:

When a UISplitView generates a popover view, it appears to then be latched to its parent view. Upon removing the UISplitView from the UIWindow subviews, you will get a CoreGraphics exception and the view will fail to be removed.

When adding other views (presumably in this case, the home screen to which you are returning), they do not autorotate, instead, the UISplitView, which has failed to be removed due to a CG exception, continues to respond to the rotation instead, causing horrible rendering bugs that can't be just "dealt with". At this point, adding any views, even re-adding the SplitView, causes a cascade of render bugs.

I then tried simply to leave the SplitView ever present as the "bottom" view, and keeping adding and removing the Home Screen from on top of it, but this fails as SplitView dominates the Orientation change calls, and Home Screen will not rotate, even if you call [homeScreen becomeFirstResponder]

You can't put SplitView into a hierarchy like UINavigationController, you will get an outright runtime error, so that option is off the table. Modals just look bad and are discourages anyway.

My presumption at this moment is that the only proper way to deal with this problem is so somehow "disarm" UISplitViewController so that it can be removed from its parent view without throwing an unhandled exception, but I have no idea how.

If you want to see an app that does exactly what I need to do, check out GILT Groupe in the iPad app store. They pulled it off, but they seem to have programmed an entire custom view transition set.

Help would be greatly appreciated.

© Stack Overflow or respective owner

Related posts about uisplitviewcontroller

Related posts about iphone