Skip to content

Instantly share code, notes, and snippets.

@NickAger
Created February 13, 2016 11:39
Show Gist options
  • Save NickAger/be37b6afecb1868a3ba8 to your computer and use it in GitHub Desktop.
Save NickAger/be37b6afecb1868a3ba8 to your computer and use it in GitHub Desktop.
iPhone upside down
// MARK: Allow iPhone to work upside-down
extension ViewController {
// allow the iPhone to work upside down; by default on the iPhone this method returns UIInterfaceOrientationMaskAllButUpsideDown
// http://stackoverflow.com/questions/12542472/why-iphone-5-doesnt-rotate-to-upsidedown/12758715#12758715
override func supportedInterfaceOrientations() -> UIInterfaceOrientationMask {
return UIInterfaceOrientationMask.All
}
}
@NickAger
Copy link
Author

For Swift 3 it becomes:

override public var supportedInterfaceOrientations: UIInterfaceOrientationMask {
    return [.landscape]
}

also I found I need to add the above to UINavigationController if the app uses one
and also check "Requires full screen" on the iPad
see: http://stackoverflow.com/questions/35274428/supportedinterfaceorientations-not-called-in-ipad

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment