I have NavigationController that handles navigation through my app. According to my design, the very first view should have no visible NavigationBar. All the others after, will.
In this FirstView, I'm using this so far to hide the NavBar, inside the ViewDidLoad:
self.navigationController?.isNavigationBarHidden = true
From this FirstView I can access other Views. In these other views I show the NavBar using:
self.navigationController?.isNavigationBarHidden = false
My problem is that:
How Can I Prevent this ?
Thank you!
Way 1: Touch “Settings” -> “Display” -> “Navigation bar” -> “Buttons” -> “Button layout”. Choose the pattern in “Hide navigation bar” -> When the app opens, the navigation bar will be automatically hidden and you can swipe up from the bottom corner of the screen to show it.
hidesBottomBarWhenPushed = true should do the work. DO NOT manually show and hide the tabbar.
You need to do three things to make a navigation bar transparent. Set background image to non-nil empty image ( UIImage() ). Set shadow image to non-nil empty image ( UIImage() ).
There's a really easy way to make this happen, and it's a property on UINavigationController called hidesBarsOnTap . When this is set to true, the user can tap anywhere on the current view controller to hide the navigation bar, then tap again to show it.
Move that code to viewWillAppear()
instead of viewDidLoad()
.
viewDidLoad()
is only called once per instantiated view controller, whereas viewWillAppear()
is called whenever the view controller is about to be presented on screen.
You can read more about the view controller lifecycle here.
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