I have added a custom tab bar. With tabs including more tab.
My First tab supports only portrait mode. Second tab has all orientations.
Issue happens when selecting the second tab and keep it in landscape mode and then select first tab in landscape mode. At that time, first tab view is cleanly rotated but tab bar remains in landscape mode.
How can i overcome this scenario? This is the should rotate method in custom tab bar controller
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
if (self.selectedIndex == 0) {
return [self.selectedViewController shouldAutorotateToInterfaceOrientation:UIInterfaceOrientationPortrait];
} else if (self.selectedIndex == 1) {
return YES;
}
return NO;}
This is the should rotate method in first and second view controllers of navigation controller
First
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return (interfaceOrientation == UIInterfaceOrientationPortrait);}
Second
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return YES;}