As the title says, the navigationBar doesn't show up after hiding it on scroll. I tried setting it in xCode as well as programmatically. Either way, the problem is still there.
override func viewDidAppear(animated: Bool) {
super.viewDidAppear(animated)
navigationController?.hidesBarsOnSwipe = true
}
Here is what it looks like after hiding the navBar. Note that the status bar color also changed color from white to black.
In viewDidLoad I have :
//MARK: navigation bar styles
self.navigationController?.navigationBar.backgroundColor = UIColor.init(red: 26/255, green: 24/255, blue: 24/255, alpha: 1)
self.navigationController?.navigationBar.clipsToBounds = true
self.navigationController?.navigationBar.titleTextAttributes = [NSFontAttributeName:UIFont(name:"GillSans", size: 20)!]
Does anyone have a good solution for this? Thank you in advance for your help!
Try this code:
Note : As you setting your navbar background close to black. You have to change your status bar content to light.
//Update your plist with below code
View controller-based status bar appearance = NO
In your ViewController:
title = "Some Title"
navigationController?.navigationBar.barTintColor = UIColor(red: 26/255, green: 24/255, blue: 24/255, alpha: 1)
navigationController?.navigationBar.tintColor = UIColor.white
//Title Colour and Font
navigationController?.navigationBar.titleTextAttributes = [NSForegroundColorAttributeName:UIColor.white, NSFontAttributeName:UIFont(name:"Arial", size: 20)!]
navigationController?.navigationBar.clipsToBounds = false
UIApplication.shared.statusBarStyle = .lightContent
}
override func viewDidAppear(_ animated: Bool) {
navigationController?.hidesBarsOnSwipe = true
}
output: