2017-09-28 76 views
0

我想查看我的應用程序在所有方向,所以我選擇了General下的所有orientaitons,然後在Xcode Project Settings倒掛方向不旋轉爲縱向

選擇info.plist下的所有orientaitons我這樣做是在AppDelegate中

func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask { 
    return UIInterfaceOrientationMask.all 
} 

,並將此在Viewcontroller

func supportedInterfaceOrientations() -> Int{ 
    return Int(UIInterfaceOrientationMask.all.rawValue) 
} 

所有其他orientati ons正在工作,但顛倒orientation.I如何得到這個工作?

回答

0

您需要打開在Xcode項目設置的方位,並在您的視圖控制器實現以下特性:

override var supportedInterfaceOrientations: UIInterfaceOrientationMask { get { return .all } } 
+0

那是我做什麼,我在我的問題提到。它不起作用 – Coder221

+0

如果您使用的是swift 3,則必須按照我寫下的方式來實現該屬性。 你實施的方式完全不同 – Rendel

相關問題