We are currently working on and ipad app that has a navigation controller. When we tap a button and open a second view - the view inherits the main navigation controller. We want to be able to set the second navigation controllers color.
We are using UINavigationBar.appearance(whenContainedInInstancesOf: [CustomNavigationController.self]) to change the color. See screen shot.
Hierarchy: View loads -> Segue to add in the side bar(buttons view) -> Tap a button -> Opens a secondary view and passes in the navcontroller.
答案 0 :(得分:1)
In the viewWillAppear
method of the view controller you can set the nav bar's tintColor
. In viewWillDisappear
you can reset the tintColor
to its previous color.