1

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...

Peter Hosey
  • 95,783
  • 15
  • 211
  • 370
OptimisticMonkey
  • 538
  • 4
  • 13
  • If you go to the application screen (hitting the main power looking button, minimizing it to the background) and re-open it (bringing it to the foreground), it works perfectly! This must definitely be a bug. – TamusJRoyce Jan 07 '12 at 01:43

2 Answers2

0

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
  • 5,107
  • 7
  • 55
  • 87
  • I've added a view controller to the page. And I tried adding a tab bar controller to that view controller. It won't let me. Plus I would have to have two tab bar controllers in that page to switch between. – TamusJRoyce Jan 07 '12 at 02:04
0

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

OptimisticMonkey
  • 538
  • 4
  • 13