Pangu Pangu - 9 months ago 53
Swift Question

Segue causes UITabBarController to shift status bar up in Swift?

I'm having a weird issue in regards to how I'm restricting screen orientation.

Here's what my storyboard looks like:

enter image description here

I have screen orientation set to Portrait only.

In my AppDelegate, I have the following:

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

In the Home Tab, clicking either the Red play button or any of the cells will perform a segue to my
. I have restricted the
to landscape only.

However, right before the segue occurs, this occurs:

enter image description hereenter image description here

Basically, what is happening is that in the 2nd picture, the red portion shifts up, pushing the status bar out of the way.

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

Once again, all of this occurs right before a Modal segue occurs.

What could be causing this? Let me know if I need to include additional code..


In an attempt to remove as much irrelevant code as possible to post a sample code on github for others to help debug, I've found the culprit of my issue.

It is related to override func prefersStatusBarHidden() in my code, causing the status bar shift and now been resolved.