segues Swift 后出现在导航栏下的灰色栏 [英] Grey bar appearing under Navigation bar after segues Swift

查看:51
本文介绍了segues Swift 后出现在导航栏下的灰色栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我转到特定的 VC 时,导航栏下方会出现一个与我的导航栏 + 状态栏大小完全相同的灰色栏.在另一个 VC 中,灰色条不存在,除非我打开 Youtube 然后使用 iOS 9返回‘应用’"按钮.

这是它的样子:

从图片中可以看出,灰色条并未覆盖 YTPlayerView,而是将其向下推.

这是怎么回事?

编辑

为了清晰起见,我添加了视图层次结构.

编辑

我为有问题的 YTPlayerView 添加了约束.

编辑

顶部布局指南的约束为 0

解决方案

我不完全理解这里的问题,但它似乎是一个视图层次结构问题?

这是有缺陷的层次结构;我改变了 stackView 的颜色,看看它是否是罪魁祸首,但事实并非如此.

我进行了更多测试,发现问题包含在 YTPlayerView 中.

YTPlayerView 开始时包含灰色空间,但在 Safari 中访问 Youtube.com 后,使用 iOS 9返回应用程序"功能,灰色条将视图推入自身.

最终解决此问题的只是将 YTPlayerView 设置为较低的层次结构,如下所示:

使用返回应用"功能后,灰色条不再出现.

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:

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.

EDIT

I added the constraints for the YTPlayerView in question.

EDIT

Constraint to top layout guide is 0

解决方案

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

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.

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:

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

这篇关于segues Swift 后出现在导航栏下的灰色栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆