I hide navbar when user scrolls the table up.
func scrollViewWillBeginDragging(scrollView: UIScrollView) {
if self.navigationController?.navigationBarHidden == false {
self.navigationController?.setNavigationBarHidden(true, animated: true)
}
}
But this method also hides the status bar.
Can't keep my status bar. These methods don't work:
UIApplication.sharedApplication().setStatusBarHidden(false, withAnimation: .None)
prefersStatusBarHidden()
Please, help!
if you are want to hide and show just navigation bar on scrollView.
you can override viewDidAppear
. & use hidesBarsOnSwipe
property of navigation controller.
override func viewDidAppear(animated: Bool) {
super.viewDidAppear(animated) navigationController?.hidesBarsOnSwipe = true }
Hope This Answer helps you.
Try make a variable shouldHideStatusBar
And override this func:
override func prefersStatusBarHidden() -> Bool {
return shouldHideStatusBar
}
when scroll put it:
shouldHideStatusBar = true/false
self.setNeedsStatusBarAppearanceUpdate()
Hope this help.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With