app让个别界面横屏,其他的为竖屏,解决如下

APP设置里面,一定要设置可以旋转的方向

appdelegate里面重新系统方向代理

func application(application: UIApplication, supportedInterfaceOrientationsForWindow window: UIWindow?) -> UIInterfaceOrientationMask {

 

        return UIInterfaceOrientationMask.Portrait  // 设置全部为竖屏

    }

在想要实现横屏的controller里面重写

是否支持自动横屏,

override func shouldAutorotate() -> Bool {

        return false

    }

 支持的方向

    override func supportedInterfaceOrientations() -> UIInterfaceOrientationMask {

         

        return UIInterfaceOrientationMask.Landscape  // 代表横屏,左右横屏

    }

物理显示屏幕,即将显示屏幕方向

    override func preferredInterfaceOrientationForPresentation() -> UIInterfaceOrientation {

        

            return UIInterfaceOrientation.LandscapeLeft

    }

 

如果此controller含nav,应该在nav里面重写这个方法,controller不需要写

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-02-14
  • 2022-12-23
  • 2022-12-23
  • 2021-05-27
  • 2021-12-16
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-07-18
  • 2022-12-23
  • 2022-12-23
  • 2021-12-25
  • 2022-12-23
相关资源
相似解决方案