angeldev February 2016

supportedInterfaceOrientations not called in iPad

I have a UITabBarController subclass and it has the below code:

class TabBarController: UITabBarController {

// MARK: Methods

override func viewDidLoad() {

    super.viewDidLoad()

}

override func supportedInterfaceOrientations() -> UIInterfaceOrientationMask {

    print(self.selectedIndex)
    if self.selectedIndex == 1 {
        return .Portrait
    }

    return .All


   }

}

The function supportedInterfaceOrientations is only called when I execute the app from an iphone. If I execute the app from my iPad mini it is not called. Any idea of the reason of this behaviour?

Answers


angeldev February 2016

It is very strange, but if I deselect Upside Down from the device orientation for iPads supportedInterfaceOrientations is called.

enter image description here

UPDATE:

If 'Requires full screen' setting from 'General' is enable, will allow the orientation delegate methods shouldAutorotate, preferredInterfaceOrientation, and supportedInterfaceOrientations to fire.

Post Status

Asked in February 2016
Viewed 1,863 times
Voted 7
Answered 1 times

Search




Leave an answer