Disabled UIButton not faded or grey
In my iPhone app, I have a UIButton which I have created in Interface Builder. I can successfully enable and disable it like this in my code ...
sendButton.enabled = YES;
or
sendButton.enabled = NO;
However, the visual look of the button is always the same! It is not faded or grey. If I attempt to click it though, it is enabled or disabled as expected. Am I missing something? Shouldn't it look faded or grey?
You can use following code:
sendButton.enabled = YES;
sendButton.alpha = 1.0;
or
sendButton.enabled = NO;
sendButton.alpha = 0.5;
just change state config to disable and choose what you want, background Image for disabled state
Another option is to change the text color (to light gray for example) for the disabled state.
In the storyboard editor, choose Disabled
from the State Config
popup button. Use the Text Color
popup button to change the text color.
In code, use the -setTitleColor:forState:
message.