简体   繁体   English

IOS设备方向卡在纵向模式下,没有横向

[英]IOS Device Orientation Stuck at Portrait mode, no Landscape

I'm using Xcode 4.3.2 and an iPad simulator 5.1 我正在使用Xcode 4.3.2和iPad模拟器5.1

I really need some help with this, my app is stuck at portrait mode. 我真的需要一些帮助,我的应用程序停留在纵向模式。

When I rotate the simulator I've tried looking under the project settings and have these checked: Portrait, Upside Down, Landscape Left and Landscape Right. 当我旋转模拟器时,我尝试在项目设置下查看并检查这些:纵向,颠倒,左侧风景和右侧风景。

I also these methods in the view controllers: 我在视图控制器中也有这些方法:

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

can anyone please help? 有人可以帮忙吗?

Check your supporting orientations in the project's settings or on *.plist file. 在项目设置或*.plist文件中检查支持方向。 Also, if you are using UITabBarController or smth else, all of your controllers have to support all orientations! 此外,如果您使用的是UITabBarController或其他,则所有控制器都必须支持所有方向!

use cmd+shift+f and type - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 使用cmd + shift + f和类型 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation

make sure all of them return YES if you want all orientations supported and NO For unsupported orientations 如果您希望支持所有方向,请确保所有这些都返回YES,否则对于不支持的方向,则返回NO

Make sure you only have one controller showing. 确保只显示一个控制器。 I've seen this problem when I have multiple views with different controllers showing at the same time. 当我有多个视图同时显示不同的控制器时,我已经看到了这个问题。

Yeah I had the same problem and the other answers here didn't fix my situation. 是的我有同样的问题,这里的其他答案并没有解决我的情况。 I found I had to check the "Resize View from NIB" box in all the relevant views . 我发现我必须在所有相关视图中检查“从NIB调整视图”框

See screenshot below (although shows a slightly older version of XCode). 请参见下面的屏幕截图(尽管显示了稍微旧版本的XCode)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM