使用 self.navigationController.hidesBarsOnSwipe = true 隐藏导航栏,将其永久隐藏 [英] Hiding Navigation bar with self.navigationController.hidesBarsOnSwipe = true, hides it permanently

查看:24
本文介绍了使用 self.navigationController.hidesBarsOnSwipe = true 隐藏导航栏,将其永久隐藏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的视图控制器中有一个 UITableView 对象,我在 viewDidAppear: 中添加了以下代码:

self.navigationController.hidesBarsOnSwipe = true

当我向上滚动时导航栏隐藏,但当我向下滚动时它不会回来.

我还需要做些什么吗?

解决方案

storyboard默认添加tableview top约束到Top Layout Guide.Bottom",需要将tableview.top约束改为View.Top"

I have a UITableView object in my view controller and I added the following code inside viewDidAppear::

self.navigationController.hidesBarsOnSwipe = true

The navigation bar is hiding when I scroll up, but when I scroll down it's not coming back.

Do I need to do something else?

解决方案

By default storyboard add tableview top constraint to "Top Layout Guide.Bottom", you need to change the tableview.top constraint to "View.Top"

这篇关于使用 self.navigationController.hidesBarsOnSwipe = true 隐藏导航栏,将其永久隐藏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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