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不需要写

 

posted on 2016-08-10 15:18  纯情的小公鸡  阅读(1680)  评论(1编辑  收藏  举报