Status bar orientation issues

I’m having a problem with the status bar of an application in My iPad.

I am using a UINavigationController. The root view controller allows all rotations by returning YES in the shoulAutoRotate method. This root view controller has two viewing modes when it comes to portrait or landscape orientation, which I managed to change programmatically without using a nib file.

The fact is that when I launch my application in the landscape, sometimes the status bar will be in the portrait. This will cause a white bar to appear on the top panel or force VC to load portrait view when the iPad is in landscape mode.

I checked my plist file and configured the correct orientations correctly

<key>UISupportedInterfaceOrientations</key>
    <array>
        <string>UIInterfaceOrientationPortrait</string>
        <string>UIInterfaceOrientationPortraitUpsideDown</string>
        <string>UIInterfaceOrientationLandscapeLeft</string>
        <string>UIInterfaceOrientationLandscapeRight</string>
    </array>

Another thing is that when I press the view controller in landscape mode, which does not show the status bar, it will disappear correctly. But then, when this vc is pushed by the navigation controller, the status bar will return in portrait or even portrait orientation upside down.

Is this a mistake or am I doing something wrong? I could add a lot of code, but I do not want the question to be unreadable. Feel free to ask whichever part of the code you need.

early!

+3
source share
1 answer

to try:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return YES; }
+2
source

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


All Articles