自动布局和[隐藏推送QUOT当底栏; [英] Auto Layout and "Hide bottom bar when pushed"

查看:185
本文介绍了自动布局和[隐藏推送QUOT当底栏;的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序的(简化)的结构是这样的:

My app's (simplified) structure is this:

的UITabBarController 一个的UINavigationController 持有的UITableViewController 作为根视图控制器。

UITabBarController with one UINavigationController holding a UITableViewController as root view controller.

攻表视图控制器单元之一的时候,我把一个普通的UIViewController (让称之为VC)到底隐藏底部标签栏。 (使用标志当推隐藏底栏)

when tapping one of the table view controller cells, I push a regular UIViewController (lets call it VC) end hiding the bottom tab bar. (using the "Hide bottom bar when pushed" flag)

在故事板我添加了一个普通的的UIView 子类VC看起来像一个底吧,我用自动布局,以将其固定到VC视图的底部。

In storyboard I added a regular UIView subclass to VC that look like a bottom bar, and I use Auto Layout to pin it to the bottom of the VC view.

问题结果
当我把VC需要第二个这种观点引脚的底部,它看起来像自动布局其固定在底部,如果标签栏是不是隐藏和秒后,认识到标签栏被隐藏,移动它到视图的实际底部。

The problem
when I push VC it takes a second for this view to pin to the bottom, it looks like auto layout pin it to the bottom as if the tab bar is not hidden and after a sec it recognise that the tab bar is hidden and moves it to the real bottom of the view.

我知道它不是最好的解释,所以我增加了一个<一个href=\"https://onedrive.live.com/redir?resid=8648042F7CE0575!107&authkey=!AN_CMRRlUlovrms&ithint=file%2Czip\">very简单的项目来证明这个问题。

I know its not the best explanation, so I added a very simple project to demonstrate the issue.

推荐答案

现在的问题是这种特定的约束条件是视图,视图的底部导轨的顶部之间。

The problem is with this specific constraint which is between the view and the top of the bottom layout guide.

选择的约束和编辑它的第二项财产

Select the constraint and edit its "Second Item" property

在这里,您需要选择底部

Here you need to choose bottom

一旦你的,粉红色的观点不被布局引导了影响。布局指南似乎承认,标签栏被隐藏后,才推视图控制器的根视图是在主屏幕的边界和发生这种情况只有在动画完成。

Once you have that, the pink view is not influenced by layout guide anymore. The layout guide seem to acknowledge that the tab bar is hidden only after the root view of the pushed view controller is in the bounds of main screen and this happens only when the animation is finished.

和是视图层次结构需要再次布置的原因引起的不希望的动画。

And that is the reason the view hierarchy needs to be laid out again which causes the unwanted animation.

这篇关于自动布局和[隐藏推送QUOT当底栏;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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