Search code examples
iosios7

Auto-rotation for hidden view controllers(iOS7)


The app only supports landscape. First, I have a view controller. Inside it, I have a bottom bar view controller. When I click the bottom bar view controller, a settings view controller(modal view) appears. Then if I rotate 180 degrees, the settings view controller does rotate while the original view controller is upside down. Any ideas to fix it? This is only on iOS 7(not iOS 8).


Solution

  • In your settings view controller try this:

    - (NSUInteger)supportedInterfaceOrientations {
    
         return UIInterfaceOrientationMaskLandscape;
    }
    
    - (BOOL)shouldAutorotate {
    
        return NO;
    }
    

    You can try also UIInterfaceOrientationMaskLandscapeLeft or UIInterfaceOrientationMaskLandscapeRight if you supports only one landscape orientation.