Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

supportedInterfaceOrientations not called on iOS 13

On iOS 13, pushing a view controller using segue such as "Show" causes supportedInterfaceOrientations not to be called on presented view controller(VC2). As a result, the controller autorotates to portrait mode even though supportedInterfaceOrientations returns only .landscape. However, if we push another view controller(VC3) from this controller(VC2) via any segue, VC3 does not autorotate.

The only workaround I have found is presenting VC2 as modal view controller using modal presentation style fullScreen. This is not I want on iPad devices, so looking for the reason why it is happening this way on iOS 13 and a fix.

like image 312
Deepak Sharma Avatar asked Aug 17 '19 19:08

Deepak Sharma


People also ask

What is UIInterfaceOrientationMask?

func application(UIApplication, supportedInterfaceOrientationsFor: UIWindow?) -> UIInterfaceOrientationMask. Asks the delegate for the interface orientations to use for the view controllers in the specified window. enum UIInterfaceOrientation. Constants that specify the orientation of the app's user interface.

What method is called to give orientation support to device?

plist->supporting interface orientation.


1 Answers

You have to set the 'presentation style' on the view controller to Full Screen, then the supportedInterface override will get called.

Story board

or check out this for even more info

How to present a modal atop the current view in Swift

like image 122
John Lanzivision Avatar answered Oct 18 '22 21:10

John Lanzivision