ObjC - 自动视图旋转

时间:2012-05-09 09:14:12

标签: iphone autorotate

我的同学和我为iPhone编写了一个Objective-c程序。 但是我们遇到了一个大问题:

我们的应用程序以纵向模式编码,但应以横向模式(直接)显示2或3个视图。 我们在这些视图中激活了横向自动旋转,但是,如果我们现在打开其中一个视图,我们再次获得肖像,当我们转动设备时,它只会变成横向。

(已经在我们的测试设备上,没有IOS模拟器的问题!)

有人可以帮助我们吗?

1 个答案:

答案 0 :(得分:1)

唯一对我有用的是

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

在我的ViewController中,并使用 presentModalViewController 进行演示。 这迫使视图保持在风景中。