self.navigationController.hidesBarsOnSwipe = true 时隐藏导航栏,永久隐藏
Hiding Navigation bar with self.navigationController.hidesBarsOnSwipe = true, hides it permanently
我的视图控制器中有一个 UITableView
对象,我在 viewDidAppear:
中添加了以下代码:
self.navigationController.hidesBarsOnSwipe = true
向上滚动时导航栏隐藏,向下滚动时导航栏不会返回。
我还需要做其他事情吗?
检查你的 constraints
tableview
。它的 top constraint
应该是 pin with superview's top
而不是 toplayoutguide's top
。我认为您已经使用 toplayoutguide 设置了约束。所以,尝试用superview的top来改变它,你的问题就解决了。
我认为您需要取消选中 Extended edges- under top bars 以使您的 UITableView 与 topLayourGuide 对齐。参考附件。
默认情况下,storyboard 将 tableview top 约束添加到 "Top Layout Guide.Bottom",您需要将 tableview.top 约束更改为 "View.Top"
我的视图控制器中有一个 UITableView
对象,我在 viewDidAppear:
中添加了以下代码:
self.navigationController.hidesBarsOnSwipe = true
向上滚动时导航栏隐藏,向下滚动时导航栏不会返回。
我还需要做其他事情吗?
检查你的 constraints
tableview
。它的 top constraint
应该是 pin with superview's top
而不是 toplayoutguide's top
。我认为您已经使用 toplayoutguide 设置了约束。所以,尝试用superview的top来改变它,你的问题就解决了。
我认为您需要取消选中 Extended edges- under top bars 以使您的 UITableView 与 topLayourGuide 对齐。参考附件。
默认情况下,storyboard 将 tableview top 约束添加到 "Top Layout Guide.Bottom",您需要将 tableview.top 约束更改为 "View.Top"