I\'m having an issue with a UIBarButtonItem
. I use the appearance proxy to set its color for states Normal
and Disabled
and I do this in t
This updates the answer for Swift 4.0:
barButtonItem.setTitleTextAttributes([NSAttributedStringKey.foregroundColor: UIColor.gray], for: UIControlState.disabled)
This shows an illustrative example of an orange color for disabled against a white barTintColor:
barTintColor = .white
cancelButton.isEnabled = false
cancelButton.setTitleTextAttributes(
[NSAttributedStringKey.foregroundColor: UIColor.orange],
for: UIControlState.disabled)