隐藏视图控制器的自动旋转(iOS7)

Auto-rotation for hidden view controllers(iOS7)

应用仅支持横屏。首先,我有一个视图控制器。在它里面,我有一个底栏视图控制器。当我单击底部栏视图控制器时,会出现一个设置视图控制器(模态视图)。然后,如果我旋转 180 度,设置视图控制器会旋转,而原始视图控制器是倒置的。有什么办法可以解决吗?这仅适用于 iOS 7(而非 iOS 8)。

在您的设置视图控制器中试试这个:

- (NSUInteger)supportedInterfaceOrientations {

     return UIInterfaceOrientationMaskLandscape;
}

- (BOOL)shouldAutorotate {

    return NO;
}

您也可以尝试 UIInterfaceOrientationMaskLandscapeLeftUIInterfaceOrientationMaskLandscapeRight 如果您只支持一种横向方向。