6
votes

Hi i am making a custom UIButton which have images for UIControlStateNormal and UIControlStateSelected. But when i set [myBtn setEnabled:No]; it changes back to UIControlStateNormal state instead of disabling at selected state. How can i keep the current state of button and disable it?

3
Just Checking it in my case it should work thanks and will mark your answer right as soon as i test it :) - Hassy

3 Answers

5
votes

Use userInteractionEnabled = NO instead of enable disable.

3
votes

try to set like this,i hope this will helps you

[buttMR setBackgroundImage:yourButton.currentBackgroundImage forState:UIControlStateDisabled];
0
votes

Set an image for the disabled state as well : UIControlStateDisabled

[myButton setImage:disabledImage forState:UIControlStateDisabled];