I tried the next:
UIDevice.currentDevice().setValue(UIInterfaceOrientation.Portrait.rawValue, forKey: \"orientation\")
on
You can override UIViewController.supportedInterfaceOrientations() instead of triggering rotation in viewWillAppear
For Xcode 7
override func supportedInterfaceOrientations() -> UIInterfaceOrientationMask {
return UIInterfaceOrientationMask.Landscape
}
For Xcode 6
override func supportedInterfaceOrientations() -> Int {
return Int(UIInterfaceOrientationMask.Landscape.rawValue)
}
And make sure the desired orientations are enabled in project settings.