Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 781
hover Avatar asked Dec 24 '11 21:12

hover


1 Answers

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];
like image 169
Ecarrion Avatar answered Oct 05 '22 23:10

Ecarrion