为什么模拟器在 Xcode4 上总是以横向模式启动?
我刚刚在我的机器上安装了 Xcode4,设置了一个新项目。
当我运行模拟器时,iPhone 始终显示为横向模式。有人知道我在哪里找到了纵向运行它的神奇设置,这样我的头就不会一直扭曲吗?
谢谢
编辑:
看来我的代码中一定有某些东西使模拟器硬件提示为横向模式,因为在我测试我的应用程序之前和之后它又是protrait......奇怪......
不知道我可以在哪里做这样的事情因为我使用一个新项目(基于选项卡栏)并且只在第二个 VC 周围摆弄...
另外 - 旋转设备时,状态栏和内容不会改变方向...
I just installed Xcode4 on my machine, setting up a new project.
When I run the simulator, the iphone always appears in Landscape mode. Anyone knows where I find the magic setting to run it in portrait so my head doesn't get twisted all the time?
thanks
EDIT:
It appears there must be sth in my code that makes the simulator hardware tip to landscape mode since before and after I test my app it is protrait again ... wierd ...
Not sure where I could have done sth like that to it since I use a new project (tab bar based) and only fiddle around the second VC ...
Also - when rotating the devide, the status bar and content do not change orientation ...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我刚刚遇到了同样的问题。但所有支持的界面方向都是在项目-目标-摘要-支持的设备方向中选择的。
但模拟器以横向模式启动还有另一个原因。 project-info.plist 文件的“支持的界面方向”项的顺序也很重要。检查“肖像(底部主页按钮)”是否位于列表中的第一个位置。如果没有,只需将其向上移动即可。
I just had the same problem. But all supported interface orientations were selected in Project - Target - Summary - Supported Device Orientations.
But there is another reason why the simulator starts in landscape mode. The order of the 'Supported interface orientation' items of your project-info.plist file is also important. Check if the "Portrait (bottom home button)" is on the very first position in the list. If not, just move it up.
在 Xcode 4 中使用某些模板时会发生这种情况。更改很容易:
稍后,如果您的应用程序需要横向方向,那么您只需将所需的方向添加回 info.plist 即可文件。请记住在适用的视图控制器的 shouldAutorotateToInterfaceOrientation: 方法中为这些方向返回 YES。
This happens when using some of the templates in Xcode 4. It's easy to change:
Later, if your app requires landscape orientation then you can simply add your desired orientations back into the info.plist file. Remember to return YES for these orientations in the applicable view controller's shouldAutorotateToInterfaceOrientation: method.
这是临时解决方案,您可以在横向模式下移动模拟器。
单击扩展坞上的模拟器 ->硬件->使用向左或向右旋转
This is temporary solution, you can move your simulator when it comes in landscape mode.
Click on simulator on dock -> Harware -> use rotate left or Right
我刚刚遇到了同样的问题。
我发现在支持的设备方向的灰色区域(深灰色表示已选择),您可以关闭所有内容,然后根据您心中的顺序重新选择您可能想要使用的方向。因此,如果您希望模拟器始终首先运行纵向模式,只需先将其打开,然后再打开其他按钮即可。
I just had the same problem.
I found out that on that grey area of Supported Device Orientations (dark grey means selected), you can switch everything off, and reselect the orientation you might want to use according to the order in your mind. so if you want want your simulator always firstly run portrait mode, just switch it on first, and then after that you can switch other buttons on.