0

我的 iPhone 应用程序包括 2 个视图方向:纵向和横向。它以纵向开始,但包含 2 个视图控制器,它们应自动旋转为横向。

那是我在横向视图中的代码:

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

但是当视图在 iPhone 模拟器中加载时,虚拟设备保持纵向,并且横向视图的内容无法正确显示。我必须手动转动设备(模拟器)。

你能给我一个解决我的问题的方法吗?还是只是模拟器的问题?

4

1 回答 1

0

您可以在 info.plist 中指定初始界面方向 - 这应该让您的应用程序以正确的方向启动。查找名为Initial interface orientation.

或者,如果您找不到该行,请将此行添加到您的 info.plist:

UIInterfaceOrientation具有值:(字符串)UIInterfaceOrientationLandscapeRight

希望有帮助。

于 2012-02-22T20:40:33.323 回答