Log139 Log139 - 2 years ago 213
Objective-C Question

uibarbuttonitem highlight tint/color

can we change the color/tint of a uibarbuttonitem when it is selected and it highlights? The app i am creating will be be used out doors often and would like it to be more noticeable in high glare situations for the user to know that he actually pressed the button.

EDIT: i would like to change the color for the button's highlighted state

Answer Source

I haven't tried this, but you could try subclassing UIBarButtonItem and then overriding the touchesEnded:withEvent: and touchesBegan:withEvent: methods and then using them to set the tintColor for your UIBarButtonItem instance.

You'd add this to your UIBarButtonItem subclass:

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
    self.tintColor = [UIColor redColor];

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
    self.tintColor = [UIColor blueColor];
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download