UITabBarViewController doesn't rotate - iOS

201 views Asked by At

I have a UITabBarViewController that contains 5 tabs and a login view which is not part of my tab bar, in my settings I have set that I support all device orientations. but when I run my app, only my login view is the only which rotates.

I have created a custom UITabBarController and implemented these methods

-(BOOL)shouldAutorotate
{
   return YES;
}

-(NSUInteger)supportedInterfaceOrientations
{
  return UIInterfaceOrientationMaskAll;
}

still my tabbar doesn't rotate, but I can see that my status bar disappears when change my device orientation to landscape.

How can I solve this?

2

There are 2 answers

1
Alex Cheng On BEST ANSWER

Try to override this method, don't call super

- (void)viewWillTransitionToSizeCGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator
{
    //[super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
    [self.selectedViewController viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
} 
0
Endama On

I also had a similar problem on Xcode 7, iPad 2, iOS 9.

The view controllers were not passing down the shouldAutoRotate message correctly. I ended up having to uncheck the PortraitUpsideDown option for the project and for some reason, that ended up fixing the issue.