app讓個別界面橫屏,其餘的爲豎屏,解決以下

app讓個別界面橫屏,其餘的爲豎屏,解決以下

APP設置裏面,必定要設置能夠旋轉的方向app

appdelegate裏面從新系統方向代理ide

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

 

        return UIInterfaceOrientationMask.Portrait  // 設置所有爲豎屏代理

    }blog

在想要實現橫屏的controller裏面重寫it

是否支持自動橫屏,io

override func shouldAutorotate() -> Bool {class

        return false方法

    }im

 支持的方向

    override func supportedInterfaceOrientations() -> UIInterfaceOrientationMask {

         

        return UIInterfaceOrientationMask.Landscape  // 表明橫屏,左右橫屏

    }

物理顯示屏幕,即將顯示屏幕方向

    override func preferredInterfaceOrientationForPresentation() -> UIInterfaceOrientation {

        

            return UIInterfaceOrientation.LandscapeLeft

    }

 

若是此controller含nav,應該在nav裏面重寫這個方法,controller不須要寫

相關文章
相關標籤/搜索