SupportInterfaceOrientations not called on iPad

I have a subclass of UITabBarController and it has the following 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 supportedInterfaceOrientations function is called only when the application is running from iphone. If I run the application from my iPad mini, it will not be called. Any idea what causes this behavior?

+5
source share
1 answer

This is very strange, but if I deselected Upside Down from the device orientation for iPads supportedInterfaceOrientations , it is called.

enter image description here

UPDATE:

If the Full Screen Required option from General is enabled, it will allow the delegate methods of orientation shouldAutorotate , preferredInterfaceOrientation and supportedInterfaceOrientations .

+27
source

Source: https://habr.com/ru/post/1242555/


All Articles