当我运行它时,我似乎无法将我的应用程序保持在纵向模式,我将支持的设备方向设置为仅纵向并且它仍然旋转,所有帮助将不胜感激,谢谢!
答案 0 :(得分: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>
答案 1 :(得分:0)
将此内容写入所有viewcontrollers:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}