【问题标题】:One View Controller Portrait, The Other Landscape一个视图控制器纵向,另一个横向
【发布时间】:2012-12-09 14:10:25
【问题描述】:

我的初始视图控制器是纵向的,我希望下一个视图控制器只能是横向的。用户不能转动 iPhone/iPad 来改变旋转。有人可以帮我解决这个问题吗?

任何帮助表示赞赏。

【问题讨论】:

    标签: iphone ipad rotation xcode4.5 uiinterfaceorientation


    【解决方案1】:

    我想你想要的是:UIViewController 类的shouldAutoRotateToInterfaceOrientation 方法。

    如果您的UIView 支持方向,则此函数返回YES。如果你return YES 只对landscape orientation,那么 iPhone 会自动被放在那个方向。

    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
        // Return YES for supported orientations
        return (interfaceOrientation == UIInterfaceOrientationLandscape);
    }
    

    祝你好运!!!

    【讨论】:

      【解决方案2】:

      也许您正在寻找UIViewController shouldAutorotateToInterfaceOrientation 或其他一些与定向相关的成员。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-12-21
        • 2013-12-20
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多