Search code examples
iosuinavigationcontrollerstoryboard

Grey bar appearing under Navigation bar after segues Swift


A grey bar exactly the size of my navigation bar + status bar appears under my navigation bar when I segue to the specific VC. In another VC the grey bar isn't there unless I open Youtube then use the iOS 9 "back to 'App'" button.

Here is what it looks like:

enter image description here

As you can see from the picture, the grey bar is not covering the YTPlayerView but is instead shoving it down.

What is going on here?

EDIT

I added the view hierarchy for clarity.

enter image description here

EDIT

I added the constraints for the YTPlayerView in question.

enter image description here

EDIT

Constraint to top layout guide is 0

enter image description here


Solution

  • I don't fully understand the issue here but it seems to have been a view hierarchy issue?

    enter image description here

    This was the flawed hierarchy; I changed the color of the stackView to see if it was the culprit but it was not.

    I did some more testing and found out that the issue was contained within the YTPlayerView.

    enter image description here

    The YTPlayerView started out including the grey space but after going to Youtube.com in Safari the using the iOS 9 "Back to App" function the grey bar shoved the view down into itself.

    What finally fixed this issue is merely setting the YTPlayerView lower in the hierarchy like so:

    enter image description here

    The grey bar does not appear after using the "Back to App" function anymore.