I have a tab bar application with mixed orientation support for only some views. One of the child view controller shown from one of the tab's navigation controller is displayed only in Landscape mode.
In order to accomplish this, I've done the view transformation for the child view as suggested here:
Is there a documented way to set the iPhone orientation?
The only problem I'm seeing is that after I've performed the orientation adjustment for the child controller and then readjusted orientation back to normal on its dismissal, the contents of the (parent) navigation controller is still shown with Landscape mode dimensions despite the navigation controller reporting the correct value for the interfaceOrientation.
How do I ensure that view's size is reset to match the orientation without hardcoding screen dimensions?
I have the following in the root navigation controller's viewWillAppear (invoked after the child controller is dismissed):
- (void)viewWillAppear:(BOOL)animated
{
NSLog(@"viewFrame: (%2f, %2f), width: %2f, height: %2f\n",
self.view.frame.origin.x, self.view.frame.origin.y,
self.view.frame.size.width, self.view.frame.size.height);
// Frame values are (0, 0) for (x,y) width: 320, height: 367 before I
// displayed child controller.
// Frame values are (0,0) width: 480, height: 219 after returning from child
// controller -- still has the landscape dimensions
NSLog(@"orientation: %d", self.interfaceOrientation);
// reports portrait as expected
}
I've tried to invoke 'layoutIfNeeded' as well as 'setNeedsDisplay' on the view but neither of them bring the view contents into the correct display.
Any suggestions would be greatly appreciated.