2012-05-09 55 views
0

我和我的同学们为iPhone编码了一个Objective-C程序。 但我们有一个很大的问题:ObjC - 自动查看旋转

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

任何人可以帮助我们,请(已经是我们的测试设备,在IOS模拟器的没问题!上)?

回答

1

只为我工作的事情,用

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

在我的ViewController与presentModalViewController呈现它。 这会强制View保持风景。

+0

谢谢! presentModalViewController解决了我们的问题! 现在我有这个问题,我在我的横向视图中没有导航栏。我该怎么办? – kerimrohs

+1

您可能必须将自己的NavigationController添加到呈现在横向中的视图中。 – muffe