iOS 8 upside down orientation, XCode option enabled, still doesn't work

后端 未结 3 912
我在风中等你
我在风中等你 2020-12-05 23:57

I have a universal application being developed in iOS8 (XCode 6.1.1). It will support all the 4 orientations (left, right, portrait & upside down).

The problem i

3条回答
  •  孤街浪徒
    2020-12-06 00:58

    If you are running inside of a navigation controller or tab bar controller, you will need to do the same override in your subclass or override all instances with an extension:

    extension UINavigationController {
      override public func supportedInterfaceOrientations() -> UIInterfaceOrientationMask {
        return .All
      }
    }
    
    extension UITabBarController {
      override public func supportedInterfaceOrientations() -> UIInterfaceOrientationMask {
        return .All
      }
    }
    

    Edit: as of Swift 3.0 / iOS 9 (and possibly earlier) this would be:

    extension UINavigationController {
        override open var supportedInterfaceOrientations : UIInterfaceOrientationMask     {
            return .all
        }
    }
    
    extension UITabBarController {
        override open var supportedInterfaceOrientations : UIInterfaceOrientationMask     {
            return .all
        }
    }
    

提交回复
热议问题