The UITabBarController, sadly, doesn't handle view controllers with different rotation requirements very well. The best way to handle this is to subclass UITabBarController and in shouldAutorotate, simply pass the request on to the view controller that is on screen. The code would look like this:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Let's grab an array of all of the child view controllers of this tab bar controller
NSArray *childVCArray = self.viewControllers;
// We know that at 5 or more tabs, we get a "More" tab for free, which contains, assumingly,
// a more navigation controller
if (self.selectedIndex <= 3) {
UINavigationController *navController = [childVCArray objectAtIndex:self.selectedIndex];
// We're in one of the first four tabs, which we know have a top view controller of UIViewController
UIViewController *viewController = navController.topViewController;
return [viewController shouldAutorotateToInterfaceOrientation:interfaceOrientation];
}
else {
// This will give us a More Navigation Controller
UIViewController *viewController = [childVCArray objectAtIndex:self.selectedIndex];
return [viewController shouldAutorotateToInterfaceOrientation:interfaceOrientation];
}
return NO;
}
This assumes that you're 5+ view controllers use the tab bar's more navigation controller and are not themselves in their own uinavigationcontroller. If they were, altering this code to fit would be trivial.
I have posted this subclass up on my github, so you can copy this method or just grab the .h/.m files from here