IOS >> Device Orientation >> Screen does not support upside down

I have a screen that supports device orientation.

Everything works fine, except that when the device is turned upside down (the home button is up), the rotation does not work (it is stuck in the last landscape settings).

I know that several places need to be updated to support this:

  • In VC itself, I added methods:

enter image description here

  • In the target topic of the project, I update as follows:

enter image description here

  • In the VC storyboard script, I update as follows:

enter image description here

What am I missing here?

+6
source share
3 answers

You also need to enable rotation to all orientations in each controller of the parent view of the current main view controller. For example, if your view controller is in the navigation controller, try subclassing it and overriding the same methods as in your example.

Edit: As @JordanC mentioned, since iOS 7, you can implement the UINavigationControllerDelegate method to return user supported orientations:

 - (UIInterfaceOrientationMask)navigationControllerSupportedInterfaceOrientations:(UINavigationController *)navigationController 
+10
source

As @eGanges pointed out, a key point might be to subclass your UITabBarController (and override supportedInterfaceOrientations ), if this is your original view controller, in this case it is the only controller you need to subclass (and, of course, you must add all supported interface orientations to the file Info.plist application UISupportedInterfaceOrientations )

+1
source

Have you tested on a real device?

anyway, try the following:

 - (NSUInteger)supportedInterfaceOrientations { return (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskPortraitUpsideDown); } 
0
source

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


All Articles