UPDATE
I ended up fixing the issues with MGSplitViewController, so I am now using this fork of the project: http://github.com/ArtSabintsev/MGSplitViewController At the time of writing this edit, the fork hasn’t been pulled into Matt Gemmell’s master branch.
Please Note
- My iPad app is Landscape only, and is iOS5 and iOS6 compatible
- I have a partially working solution, but I need to take it one step further.
- For the majority of the screens in my app, I need to present both the master and detail views (normal behavior).
- At one point, I need to only the detailVC to be present.
How am I doing it now?
I am using the following UISpliterViewControllerDelegate Method
- (BOOL)splitViewController:(UISplitViewController *)svc shouldHideViewController:(UIViewController *)vc inOrientation:(UIInterfaceOrientation)orientation
{
return self.hideRootViewController;
}
where hideRootViewController is a boolean that is set to NO initially.
The Partial Solution
If I change the boolean to YES (in any screen/VC in my app) and rotate the screen, the masterVC disappears, and the detailVC occupies the entire screen.
The Remaining Problem
How do I force this change without physically having to rotate the device, or how do I force a device orientation notification change to redraw UISplitViewController?
The following attempts have failed:
- CGAffineTansformation (Identity and small angle transformations)
- Posting a UIDeviceOrientationDidChangeNotification
- Calling setNeedsLayout on splitVC.view
- Presenting and immediately dismissing modalVC’s on splitVC
Note: I am not using MGSplitViewController, nor do I want to use that class in this project.
Why dont you use mgsplitviewcontroller. I used it in my project, it works wonderful and very easy implement. You can able hide/switch master view easily.