views:

32

answers:

2

I have two UITabBarControllers in my mainwnidow.nib wired to my appdelegate.

In my app delegate, I can load either one:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    

//either
     [window addSubview:tabBarController.view];
//or
     [window addSubview:tabBar2Controller.view];
[window makeKeyAndVisible];
}

and autorotation works.

If I add both (with the expectation to swap between them later):

 [window addSubview:tabBarController.view];
 [window addSubview:tabBar2Controller.view];

then autorotation stops working...everything is always portrait.

Thanks in advance for any tips...

A: 

Hmmm, I don't like this design. Typically windows should only have one subview.

Add another view controller that holds the instances of your tabBarControllers, and do the switching from there. That will fix your problem.

DevDevDev
A: 

After thinking it through more, I realized I could just switch out the tabBarController.viewcontrollers array.

In IB I added both sets of tabs to a single tabbar, and then the appdelegate seperates them into two arrays and swaps between them as needed.

It works fine, but the jury is still out on whether the UI is effective