Trying to make storyboard based application for iPad. In it I need to transition from start screen (UIViewController) to main screen (UISplitViewController) and then to full-screen view (again UIViewController).
I saw a number of discussions on the web (at least several – on stackoverflow), stating that UISplitViewController can't be used in Storyboard based application any other way than being RootViewController. Some threads contain workarounds and there's also alternative splitview (https://github.com/mattgemmell/MGSplitViewController) to cope with this.
But what I can't understand is why Apple documentation states quite the opposite. Here is the link to the chapter from Apple's iOS 5.0 Library. It states:
Creating a Split View Controller Using a Storyboard
To add a split view controller to your application’s storyboard:
- Open your application’s main storyboard.
- Drag a split view controller out of the library. This also creates view controllers
for the two panes of the split view controller. - For each of the split view controller’s contained view controllers, use the Identity inspector to set the class name of the view controller.
To present the split view interface, do one of the following:
- Display it as the first scene, by selecting the scene and checking
the “Is Initial View Controller” box under the Attributes inspector. - Display it from another scene, by adding a modal segue to to it.
- Display it programmatically, by calling the performSegueWithIdentifier:sender: method to initiate a modal segue.
I was trying it in many ways, but approaches described in last two statements never worked.
Both modal segue and performSegue… fail with well-known error:
"*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Application tried to present a Split View Controllers modally…"
Anyone able to explain that? Is this a bug in XCODE/iOS 5.0 or bug in documentation?
Regards,
Petr
Best Answer
According to this Apple article, the split view controller must be the root. Here is a snippet: