I am currently building an app for iPad where the view structure is completely different depending on the device orientation.
When the app is in portrait I am using the ECSlidingViewController library to support left and right sliding menu’s (like facebook or path).
When the app is in landscape I need to display a splitviewcontroller so that the left hand menu is always visible.
Does anybody know of the best solution to this problem?
I have tried changing the RootViewController of the UIWindow when an orientation change is detected but this gave some very strange results….
There are several ways to do this. Some better than other, but mostly it will depends on the needs of your specific situation.
rootViewControlleras you mentioned during rotation.UISplitViewControllerand use asegueto withreplaceto replace thedetailViewControllerwhen rotating between portrait and landscape.addChildViewController:andremoveFromParentViewController:Extremely crude example of choice 3.
From what you’ve said, I’d guess option 3 would be the best fit. All this said though, I’m not entirely convinced you need to be switching view controllers, but I’m not familiar with
ECSlidingViewControllerand what it offers so I’m can’t be certain.