In iOS 11 searchBar hides when scrolling tableView if we set to hide. how can I hide searchBar, navigationBar and tabBar when scrolling collectionView up ? And unhide them all when scrolling down ? Thanks for your help...
class ViewController: UIViewController, UIScrollViewDelegate { codes... }
)Implement scrollViewDidScroll Delegate method
func scrollViewDidScroll(scrollView: UIScrollView) {
let pan = scrollView.panGestureRecognizer
let velocity = pan.velocityInView(scrollView).y
if velocity < -5 {
self.navigationController?.setNavigationBarHidden(true, animated: true)
self.navigationController?.setToolbarHidden(true, animated: true)
} else if velocity > 5 {
self.navigationController?.setNavigationBarHidden(false, animated: true)
self.navigationController?.setToolbarHidden(false, animated: true)
}
}