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
I needed tab bar to go into full screen mode in landscape view and I tried the approach suggested above using
transView.frame = CGRectMake(0, 0, 480, 320 );
This turned out to be a hacky solution and posed many problems such as with hiding and re-displaying the status bar (the view would overlap with the status bar when it is re-displayed after exiting portrait view). I would not recommend this. What worked for me perfectly in the end was pushing a new view controller containing the landscape view and using delegation to reuse the functionality of the original VC.
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.)