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
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.
Override this method and call this method in view will appear.
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation duration:(NSTimeInterval)duration
{
if (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight)
{
}
}
精彩评论