新建工程后,旋转的设置大多是如图
此时,屏幕旋转都是按照此设置的方向旋转的,- (BOOL)shouldAutorotate 等没有响应
如要设置每页不同的旋转方向,需要打开如下设置
此时将根据
1. - (BOOL)shouldAutorotate 是否可以自动旋转
2. - (UIInterfaceOrientationMask)supportedInterfaceOrientations 可旋转的方向
为什么?那就先说说怎么控制屏幕旋转,如何决定Interface Orientation
首先,全局控制
方式一Info.plist
文件中,有一个Supported Interface Orientations
,可以配置整个应用的屏幕方向,此处为全局控制。
例:Info.plist 关于旋转的设置
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations