How to force view controller orientation in iOS 8?

前端 未结 25 2534
太阳男子
太阳男子 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:25

    I tried a few solutions in here and the important thing to understand is that it's the root view controller that will determine if it will rotate or not.

    I created the following objective-c project github.com/GabLeRoux/RotationLockInTabbedViewChild with a working example of a TabbedViewController where one child view is allowed rotating and the other child view is locked in portrait.

    It's not perfect but it works and the same idea should work for other kind of root views such as NavigationViewController. :)

    Child view locks parent orientation

提交回复
热议问题