hover
hover

Reputation: 789

How to remove the greyed out look of a disbled UIButton

I've got a UIButton that i want to look exactly the same when it's in its disabled state as when it's in its Normal state. Right now it has a slight greyed out look to it.

Upvotes: 7

Views: 4190

Answers (1)

Ecarrion
Ecarrion

Reputation: 4950

Do not use enabled property or setEnabled:NO method, instead use:

[myButton setUserInteractionEnabled:NO];

That would prevent the button for being touched, but without changing his looks!

The other way is if your button is a custom button and has an image:

[button setImage:someImage forState:UIControlStateNormal];
[button setImage:someImage forState:UIControlStateDisabled];
[button setEnabled:NO];

Upvotes: 19

Related Questions