0
votes

i am setting the state of a UIButton to highlighted state programmatically.

[currentButton setHighlighted:YES];

once the user presses the button, i need to check if it is already in the highlighted state and accordingly perform some action. But, the state of the button is getting changed automatically after it is being pressed. I think this is the default behavior of a UIButton. Is there any way in which i can first check wether the button is already in the highlighted state???

2

2 Answers

2
votes

Hilighted state is only for that time when user press a button as user remove his finger it will return to its notmal state, you can set a selected state for a button and can check for this.

1
votes

Maybe:

if(currentButton.highlighted){

}