Friday, December 19, 2014

supportedInterfaceOrientations - Support Landscape orientations only.

Update March 18, 2016: 

It seems that the Swift 1 code below is no longer required for Xcode 7.2.1 (Swift 2.1.1).
Just define the portrait/landscape settings in the General ->Deployment Info -> Device Orientation section of the project settings.

========== Swift 1 code below ============

This disables the portrait orientation.

//Auto rotate is still enabled.
    override func shouldAutorotate() -> Bool {
        return true

//Only the left and right landscape orientations are supported.
    override func supportedInterfaceOrientations() -> Int {
        return Int(UIInterfaceOrientationMask.LandscapeLeft.rawValue) | Int(UIInterfaceOrientationMask.LandscapeRight.rawValue)


No comments:

Post a Comment