Segue forcing UITabBarController to move status bar in Swift?

I have a weird problem regarding how I limit the screen orientation.

Here's what my storyboard looks like:

enter image description here

My screen orientation is set to Portrait only.

In my AppDelegate app, I have the following:

func application(application: UIApplication, supportedInterfaceOrientationsForWindow window: UIWindow?) -> UIInterfaceOrientationMask { if self.window?.rootViewController?.presentedViewController is VideoPlayerViewController { return UIInterfaceOrientationMask.Landscape; } else { return UIInterfaceOrientationMask.Portrait; } } 

On the "Home" tab, clicking the "Red" button or any of the cells, you will go to my VideoPlayerViewController . I limited VideoPlayerViewController to terrain only.

However, right before segue happens, this happens:

enter image description here enter image description here

Basically, what happens is that in the second image the red part moves upward, pushing the status bar to the side.

Then, in the 3rd picture, the first 2 tabs are slightly shifted to the left , while the last 2 tabs are slightly shifted to the right .

Again, all this happens just before the Modal transition occurs.

What could be the reason for this? Let me know if I need to add additional code.

+5
source share
1 answer

In an attempt to remove as much irrelevant code as possible in order to publish the sample code on github for others to help debug, I found the culprit of my problem.

It is associated with override func prefersStatusBarHidden() in my code, causing the status bar to shift and is now allowed.

0
source

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


All Articles