简体   繁体   中英

set different color for navigation bar back button and back button text

I am trying to have different colors for back button text and back button.

If I set the global tint, it changes color for both. Is there a way I could have different color for both?

As i understand you just want to change back button color and back button in different screen different.Not globally So you can do this several way.Here is simplest way.

Just change navigation tint color of its viewDidLoad or viewWillApper method.

ViewController One:

override func viewDidLoad() {
        super.viewDidLoad()
   self.navigationController?.navigationBar.tintColor = UIColor.green

    }

ViewConbtroller Two:

override func viewDidLoad() {
        super.viewDidLoad()
   self.navigationController?.navigationBar.tintColor = UIColor.red

    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM