I've tried to hide the navigation controller for a single view controller with no luck, the navigation bar is hidden for the first vc, but it's not displaying for the second vc.
Here's the code I've used in the first vc:
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
// Hide the Navigation Bar
self.navigationController?.setNavigationBarHidden(true, animated: animated)
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
// Show the Navigation Bar
self.navigationController?.setNavigationBarHidden(false, animated: animated)
}
What's changed in swift 4? That code worked in swift 3...
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.
From the outline view, make sure your Table View Controller is selected. Then go to the Editor menu, and click on the Embed In submenu, and choose Navigation Controller and voila. You have your navigation controller pointing to your tableview controller with a relationship built in. This should be the selected answer.
navigationHide() Hides the navigation bar.
If you want to remove the opacity or transparency from the sticky navigation bar, just navigate to Theme Options -> General -> Additional CSS and copy/paste this code and save changes. You could also manipulate the opacity by altering the value “1” at the end of the CSS statement.
Use code:- Swift 5
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(true)
// Hide the Navigation Bar
self.navigationController?.setNavigationBarHidden(true, animated: true)
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(true)
// Show the Navigation Bar
self.navigationController?.setNavigationBarHidden(false, animated: false)
}
I think you have done mistake in animated: true
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