Search code examples
iphonexcodeipaduibarbuttonitemstyle

Unable to set a UIBarbutton back to the default tint color


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


Solution

  • examCancelButton.tintColor = nil;