【问题标题】:Opening a view in Landscape mode [duplicate]以横向模式打开视图[重复]
【发布时间】:2011-04-22 13:03:31
【问题描述】:

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

【问题讨论】:

  • 你的问题解决了吗????

标签: iphone objective-c landscape


【解决方案1】:

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

[self presentModalViewController:landscapeViewController animated:YES];

并在

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

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

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

【讨论】:

    【解决方案2】:

    我认为可以:

    [[CCDirector sharedDirector] setDeviceOrientation: kCCDeviceOrientationLandscapeRight];
    

    我不确定...

    【讨论】:

      【解决方案3】:

      我很确定你不能再使用setOrientation,因为它已被弃用,并且应用程序已被拒绝使用它。

      这可能是您的选择:

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

      它使用转换来旋转视图。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2012-11-20
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-06-10
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多