简体   繁体   中英

How to change a specific bar button item tint color in iOS 10

I have a TabBarController Connected to > NavigationController > TableViewController and i would like to change the tintColor just of a specific page/ barButtonItem (not all tab bar buttons) .As you know Runtime Attribute isn't working anymore in Xcode8.

I have looked across the web and tried different solutions but couldn't make it to work out so please help.

thank you

Here's an example written in Swift 3:

let barButtonItem = UIBarButtonItem(image: UIImage(named: "image_path"), style: UIBarButtonItemStyle.done, target: self, action: #selector(ViewController.didTapBarButtonItem))
barButtonItem.tintColor = YOUR_COLOR_HERE
navigationItem.rightBarButtonItem = barButtonItem

You place this in the viewDidLoad method of your view controller.

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