I have 2 view controllers, root, and detail. The root view controller supports landscape and portrait orientation, so it has the following code:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return (interfaceOrientation == UIInterfaceOrientationPortrait
|| interfaceOrientation == UIInterfaceOrientationLandscapeLeft
|| interfaceOrientation == UIInterfaceOrientationLandscapeRight
|| interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown);
}
The above code works perfectly for the root view controller.
If the root view controller is being displayed, and the user rotates the device into landscape mode, the view adjusts accordingly. From this point, if push my detail view controller on to the stack, it loads in landscape mode. But, it shouldn't, because I have it configured to only support portrait mode. I'm using the code below in my detail view controller:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}