1

我有一个应用程序,自从 6 个月前就没有修改过它,无论如何我决定在模拟器中打开它。但是在启动画面之后显示的第一个视图控制器被卷起并通过错误的方向显示。当它应该以横向显示时,它以纵向显示。

这是它的代码:

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

然而,

当我点击转到另一个视图,然后返回主视图控制器时,问题自行解决并且方向正确。

正确显示

所以它只发生在初始屏幕显示后的初始启动中。

请加入链接以查看屏幕截图,因为我还没有 10 个代表,所以我无法发布图像。

4

2 回答 2

0

在此处输入图像描述 这将确保应用程序以横向模式打开。

在 AppDelegate 中,您可能正在使用这个

[self.window addSubView:viewControllerObj]

问题出在上面的行上。在 iOS 5 中,方向将与上述行正常工作,但在 iOS 6 中,为了使方向正常工作,请将上述行更改为

[self.window setRootViewController:viewControllerObj]

然后当方向改变时应用程序会旋转

于 2013-02-28T12:21:20.230 回答
0

打开您的 plist 文件->addRow-> 添加“初始界面方向”并赋予值横向(左主页按钮)。

希望这会帮助你。

于 2013-02-28T13:48:22.880 回答