This is Portrait:
This is Landscape
I\'ve tried this on rotation with no success:
self.tableView.autoresizesSubviews = YE
Your UINavigationController
needs to get notified when the device orientation changes. This doesn't happen if you only add the view
of a UINavigationController
to another UIView
.
Starting with iOS 5, you can simply call addChildViewController:
on the parent UIViewController
, which will ensure that orientation changes are propagated to this child view controller.
I have exactly the same issue, and @jstevenco led me to a really strange solution. My views also auto resize on rotation, but the tableview doesn't seem to understand there is a navigationcontroller sitting there:
Within the tableviewcontroller, add the following:
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
{
[super didRotateFromInterfaceOrientation:fromInterfaceOrientation];
CGRect frame = navBar.frame;
if (fromInterfaceOrientation == UIInterfaceOrientationPortrait || fromInterfaceOrientation == UIInterfaceOrientationPortraitUpsideDown) {
frame.size.height = 31.9;
} else {
frame.size.height = 44.1;
}
navBar.frame = frame;
}
The 31.9 and 44.1 are very important strangly! Leaving these are 32 and 44, there is no resizing to do, so it seems to ignore it. Worked for me, hope it helps someone else.