【问题标题】:Different Initial interface orientation iPhone and iPad universal application不同的初始界面方向 iPhone 和 iPad 通用应用程序
【发布时间】:2013-07-13 09:07:36
【问题描述】:

我想要的是 iPhone 的纵向和 iPad 应用的横向。 我的应用程序针对 >
我在网上对此进行了搜索,但得到了不同的答案,但不是确切的答案。

【问题讨论】:

    标签: ios5 ios5 ios6


    【解决方案1】:

    这就是我所做的

    对于 iPhone

    对于 iPad

    对于我在下面代码中添加的 iPad 控制器, 应用程序不需要这样做

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

    【讨论】:

      【解决方案2】:

      您只需将此代码添加到您的应用委托中即可做到这一点。

      Swift 代码:

      func application(application: UIApplication, supportedInterfaceOrientationsForWindow window: UIWindow?) -> Int {
          if UIDevice.currentDevice().userInterfaceIdiom == .Phone {
              return Int(UIInterfaceOrientationMask.Portrait.rawValue)
          } else {
              return Int(UIInterfaceOrientationMask.LandscapeLeft.rawValue | UIInterfaceOrientationMask.LandscapeRight.rawValue)
          }
      }
      

      【讨论】:

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