设为首页 加入收藏

TOP

app让个别界面横屏,其他的为竖屏,解决如下
2017-10-10 12:14:17 】 浏览:7263
Tags:app 个别 界面 其他 解决 如下

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

 

】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇WKWebView进度及title 下一篇[iOS笔记]Swift中的Optional类型

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目