So here is what i have: A UITabBarController that handles different UIViewControllers. In one of the UIViewController i am trying to switch the view being displayed when the
This approach is working for me:
- (void) willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
UIView *parentView = self.tabBarController.view;
CGRect frame = parentView.frame;
CGFloat windowHeight = parentView.window.frame.size.height;
switch (toInterfaceOrientation) {
case UIInterfaceOrientationLandscapeLeft:
case UIInterfaceOrientationLandscapeRight:
CGFloat tabBarHeight = self.tabBarController.tabBar.frame.size.height;
frame.size.height = windowHeight + tabBarHeight;
break;
default:
frame.size.height = windowHeight;
break;
}
[UIView animateWithDuration:duration animations:^{
parentView.frame = frame;
}];
}
(Only tested in iOS8.)