1

I have one TabBarController that has Two tabs. Each tab has one NavigationController in it. Now if the first tab is selected and I rotate the app then shouldAutorotateToInterfaceOrientation: gets called of rootViewController of first tab nav controller and thats right but when I select the second tab and then I rotate the device then still the shouldAutorotateToInterfaceOrientation: method of first tab gets called.

I want to layout different tab differently. Any help would be appreciated. Thanks

Ideveloper
  • 1,447
  • 4
  • 23
  • 43

2 Answers2

0

Override this method and call this method in view will appear.

- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation duration:(NSTimeInterval)duration
 {
     if (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight)
  {

  }
 }
marc_s
  • 704,970
  • 168
  • 1,303
  • 1,425
iKushal
  • 2,549
  • 23
  • 19
0

The tab bar controller can only change to another orientation if the root view controller of each tab supports that orientation. Which makes sense, otherwise a user would somehow switch orientation when she selected another tab.

Steven Kramer
  • 8,433
  • 2
  • 35
  • 43