16

If I change the tint of a UIBarbutton how can I reset it to it's default tint.

Here I am set a custom tint for a button...

examCancelButton.style = UIBarButtonSystemItemCancel;
examCancelButton.tintColor = myRedButtonTint;

Then later I need to set it back to it's default style and tint. So I thought just setting the style to UIBarButtonItemStyleDone would do the trick like this...

examCancelButton.style = UIBarButtonItemStyleDone;

But the color remains red. I can set it to a nice blue color on my own, but I would like to get the default color of a UIBarButtonItemStyleDone button. Is this possible?

Thanks, John

user278859
  • 10,379
  • 12
  • 51
  • 74

1 Answers1

30

examCancelButton.tintColor = nil;

Noah Witherspoon
  • 57,021
  • 16
  • 130
  • 131
  • Works for UIButtons too. [dataProtectionButton setTitleColor:nil forState:UIControlStateNormal]; – T.J. Jan 06 '14 at 23:39