iosuitabbarcontrollerautorotateshouldstartload

UITabBarViewController doesn't rotate - iOS


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?


Solution

  • 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];
    }