grgcombs / IntelligentSplitViewController

A smarter UISplitViewController that rotates correctly when placed inside a UITabBarController
Other
111 stars 22 forks source link

UIViewController as a root #9

Closed MrZoidberg closed 9 years ago

MrZoidberg commented 13 years ago

Hi,

I'd like to use the following app controllers architecture: Window -> UIViewController -> UITabBarController -> IntelligentSplitViewController. When implement it the master view is not showing with any rotation. Is it possible to fix it?

grgcombs commented 13 years ago

Do you have a navigation controller in the hierarchy anywhere? If not, how are you presenting the tab bar controller?

Does your uiviewcontroller return 'yes' to all orientations in the shouldRotate... method?

MrZoidberg commented 13 years ago

I have 2 navigation controllers as a root of master and detail views. I'm presenting the tab bar controller with the following code: [_rootViewController.view addSubview:_tabBarController.view];. _rootViewController is a general view controller that is root view of the app and it returns 'yes' to all orientations.

grgcombs commented 13 years ago

I think that's your trouble ... that's definitely a bad idea. That tab bar view already has a view controller and your root view controller is trying to steal it out from under it.

What you want to do is just add a UITabBar to your root UIViewController, then handle the switching yourself. You could even use something like CHViewControllerSwitcher as a superclass for your root view controller, I believe, that way you can offload a lot of the boiler plate view switching to something else.

However, iOS 5 does this switching built-in, if you code your class right, so I don't know how forward compatible CHViewControllerSwitcher would be.

MrZoidberg commented 13 years ago

Thanks, I'll try to use CHViewControllerSwitcher. In fact, all I wanted to do is to place another view under split view controller. I haven't found another almost working solution than yours...