phantomon icon

Untitled

phantomon | PRO | 10/18/17 08:31:33 PM UTC | 0 ⭐ | 228 👁️ | Never ⏰ | []
Swift |

640 B

|

None

|

0 👍

/

0 👎

override func viewDidLoad() {
    super.viewDidLoad()
 
    // Force the device in portrait mode when the view controller gets loaded
    UIDevice.currentDevice().setValue(UIInterfaceOrientation.Portrait.rawValue, forKey: "orientation") 
}
 
override func shouldAutorotate() -> Bool {
    // Lock autorotate
    return false
}
 
override func supportedInterfaceOrientations() -> Int {
 
    // Only allow Portrait
    return Int(UIInterfaceOrientationMask.Portrait.rawValue)
}
 
override func preferredInterfaceOrientationForPresentation() -> UIInterfaceOrientation {
 
    // Only allow Portrait
    return UIInterfaceOrientation.Portrait
}

Comments