Unable to set a UIBarbutton back to the default tint color
Asked Answered
M

1

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

Mazda answered 12/7, 2012 at 19:52 Comment(1)
Did you try setting tintColor to nil?Unsheathe
T
30

examCancelButton.tintColor = nil;

Tafia answered 12/7, 2012 at 19:57 Comment(1)
Works for UIButtons too. [dataProtectionButton setTitleColor:nil forState:UIControlStateNormal];Magnification

© 2022 - 2024 — McMap. All rights reserved.