在横向模式下打开视图

时间:2011-04-22 13:03:31

标签: iphone objective-c landscape

我正在以纵向模式开发应用程序。在我的一个视图控制器中,当我点击表格视图时,另一个视图以纵向模式打开。我希望它以横向模式打开。 请建议我如何做到这一点。 在此先感谢!!

3 个答案:

答案 0 :(得分:1)

据我所知,实现此目的的唯一方法是将视图控制器显示为模式

[self presentModalViewController:landscapeViewController animated:YES];

并在

中指定横向模式
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    return UIInterfaceOrientationLandscapeLeft == interfaceOrientation;
}

这是因为如果模态视图只能在一个方向上显示,则应用会自动旋转到该方向。

有关详细信息,请参阅此问题的已接受答案:Transitioning to landscape rotation within a uinavigationcontroller

答案 1 :(得分:0)

我认为这样做:

[[CCDirector sharedDirector] setDeviceOrientation: kCCDeviceOrientationLandscapeRight];

我不确定......

答案 2 :(得分:0)

我很确定您不能再使用setOrientation了,因为它已被弃用且应用已被拒绝使用它。

这可能是您的选择:

http://www.iphonedevsdk.com/forum/iphone-sdk-development/33548-alternative-setorientation.html

它使用转换旋转视图。

相关问题