2017-09-28 75 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

相关问题