Advertisement
Guest User

Untitled

a guest
Feb 8th, 2016
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1.  
  2. extension UIViewController {
  3.  
  4. func supportedInterfaceOrientations() -> UIInterfaceOrientationMask {
  5. if let nvc = self as? UINavigationController {
  6. return nvc.topViewController!.supportedInterfaceOrientations()
  7. } else {
  8. return .Portrait
  9. }
  10. }
  11.  
  12. func shouldAutorotate() -> Bool {
  13. if let nvc = self as? UINavigationController {
  14. return nvc.topViewController!.shouldAutorotate()
  15. } else {
  16. return false
  17. }
  18. }
  19.  
  20. func preferredInterfaceOrientationForPresentation() -> UIInterfaceOrientation {
  21. if let nvc = self as? UINavigationController {
  22. return nvc.topViewController!.preferredInterfaceOrientationForPresentation()
  23. } else {
  24. return .Portrait
  25. }
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement