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,467
  • 4
  • 23
  • 44

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
  • 732,580
  • 175
  • 1,330
  • 1,459
iKushal
  • 2,689
  • 24
  • 20
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,473
  • 2
  • 37
  • 43