I'm programmatically creating a UINavigationController
:
navigationController = UINavigationController(rootViewController: modeSelectVC!)
navigationController?.delegate = self
window.rootViewController = navigationController
window.makeKeyAndVisible()
Then I customize my UINavigationBar
appearance like so:
navigationBarAppereance.barTintColor = UIColor.ColorPalette.bostonUniversityRed
navigationBarAppereance.tintColor = UIColor.ColorPalette.eerieBlack
navigationBarAppereance.barStyle = .black
navigationBarAppereance.isTranslucent = true
navigationBarAppereance.prefersLargeTitles = true
navigationBarAppereance.largeTitleTextAttributes = [NSAttributedStringKey.foregroundColor: UIColor.ColorPalette.babyPowder]
The configured UINavigationBar
is hidden in the rootViewController
provided along with the status bar but when the rootViewController
pushes another view controller, both the status bar and the navigation bar becomes visible like so:
The result is as I programmed it to be but as you can also see above, the back
button is misaligned. If I let go of the large title preferring, then the back button is properly aligned as usual but why does it get misaligned when large title is used.
I kind of solved the problem. Once I enabled the status bar on the initial view controller, afterwards, whatever got presented, correctly displayed the navigation bar along with the status bar.
I still don't know what caused the issue(if it was an implementation mistake of mine or poor documentation) but dealing with the UINavigationBar can be tricky!