【问题标题】:Landscape orientation for one view controller ios一个视图控制器ios的横向方向
【发布时间】:2015-12-06 13:58:47
【问题描述】:

我想在 iPhone 中以两个方向显示一个视图控制器。当屏幕打开时,首选方向应该是纵向的。然后根据设备方向旋转。我找到了一些解决方案,屏幕也在旋转。但是当我进入屏幕时,它会自动旋转为横向,而我必须手动将其旋转为纵向。

这个问题有简单的解决办法吗?

【问题讨论】:

    标签: ios objective-c iphone xcode orientation


    【解决方案1】:

    您应该实现 preferredInterfaceOrientationForPresentation 和 支持的接口方向如:

    - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
    {
       return UIDeviceOrientationPortrait;
    }
    //You don't actually need to implement this as UIInterfaceOrientationMaskAllButUpsideDown is the default for iPhone
    - (UIInterfaceOrientationMask)supportedInterfaceOrientations
    {
       return UIInterfaceOrientationMaskAllButUpsideDown;
    }
    

    【讨论】:

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