How to force view controller orientation in iOS 8?

前端 未结 25 2578
太阳男子
太阳男子 2020-11-22 13:11

Before iOS 8, we used below code in conjunction with supportedInterfaceOrientations and shouldAutoRotate delegate methods to force app orie

25条回答
  •  面向向阳花
    2020-11-22 13:37

    Use this to lock view controller orientation, tested on IOS 9:

    // Lock orientation to landscape right

    -(UIInterfaceOrientationMask)supportedInterfaceOrientations {
        return UIInterfaceOrientationMaskLandscapeRight;
    }
    
    -(NSUInteger)navigationControllerSupportedInterfaceOrientations:(UINavigationController *)navigationController {
        return UIInterfaceOrientationMaskLandscapeRight;
    }
    

提交回复
热议问题