在CollectionView中滚动tableView时隐藏NavigationBar? [英] Hide NavigationBar when scrolling tableView in CollectionView?

查看:202
本文介绍了在CollectionView中滚动tableView时隐藏NavigationBar?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有collectionViewController和collectionViewCell包含TableView.CollectionView是水平布局。我想在滚动tableView时隐藏导航栏。有没有任何想法。

I have collectionViewController and collectionViewCell include TableView.CollectionView is horizontal layout.I want hide navigationbar when scroll the tableView. Is there any idea about that.

推荐答案

从iOS 8开始,你可以使用

Since iOS 8 you can just use

self.navigationController?.hidesBarsOnSwipe = true

当然,这需要您的ViewController嵌入在NavigationController中。 NavigationController的所有子VC都将继承此行为,因此您可能希望在 viewWillAppear 中启用/禁用它。
您还可以在故事板中的导航控制器上设置相应的标志。

This requires of course that your ViewController is embedded in a NavigationController. All child VC of the NavigationController will inherit this behaviour, so you might want to enable/disable it in viewWillAppear. You can also set the respective flags on the navigation controller in the storyboard.

这篇关于在CollectionView中滚动tableView时隐藏NavigationBar?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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