I’m trying to set the title color for all UIBarButtonItems
When I use:
[[UIBarButtonItem appearance] setTitleColor:normalTitleColor forState:UIControlStateNormal];
I get :
-[_UIBarItemAppearance setTitleColor:forState:]: unrecognized selector sent to instance 0xd695e30
I didn’t have any problems with background image but title color isn’t working so well.
It’s because it doesn’t exist in the class UIBarButtonItem or in it’s super class
You can use this method define in UIBarItem
Sets the title’s text attributes for a given control state.
Parameters
attributes
A dictionary containing key-value pairs for text attributes.
You can specify the font, text color, text shadow color, and text shadow offset using the keys listed in NSString UIKit Additions Reference.
state
The control state for which you want to set the text attributes for the title.
Availability
Available in iOS 5.0 and later.
See Also
Declared In