Created
February 8, 2016 18:03
-
-
Save krodak/26ecbb59d2ae39cbe1ee to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension UIViewController { | |
func supportedInterfaceOrientations() -> UIInterfaceOrientationMask { | |
if let nvc = self as? UINavigationController { | |
return nvc.topViewController!.supportedInterfaceOrientations() | |
} else { | |
return .Portrait | |
} | |
} | |
func shouldAutorotate() -> Bool { | |
if let nvc = self as? UINavigationController { | |
return nvc.topViewController!.shouldAutorotate() | |
} else { | |
return false | |
} | |
} | |
func preferredInterfaceOrientationForPresentation() -> UIInterfaceOrientation { | |
if let nvc = self as? UINavigationController { | |
return nvc.topViewController!.preferredInterfaceOrientationForPresentation() | |
} else { | |
return .Portrait | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment