1

当我运行它时,我似乎无法将我的应用程序保持在纵向模式,我将支持的设备方向设置为仅纵向并且它仍然旋转,所有帮助将不胜感激,谢谢!

4

2 回答 2

3

在所有视图控制器中写这个

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return NO;
}

同样在 project-info.plist

更改键的值

<key>UISupportedInterfaceOrientationss</key>
<array>
    <string>UIInterfaceOrientationPortrait</string>
    <string>UIInterfaceOrientationLandscapeLeft</string>
    <string>UIInterfaceOrientationLandscapeRight</string>
</array>

<key>UISupportedInterfaceOrientationss</key>
<array>
    <string>UIInterfaceOrientationPortrait</string>
</array>
于 2012-06-03T19:52:14.753 回答
0

将此写入所有视图控制器:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
于 2012-06-08T06:05:19.817 回答