Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 360
angeldev Avatar asked Feb 08 '16 16:02

angeldev


1 Answers

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.

like image 165
angeldev Avatar answered Oct 15 '22 09:10

angeldev