简体   繁体   中英

How to programmatically get the highlighted state of a UIButton

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???

仅当用户按下按钮并松开手指时,该按钮才返回到正常状态,此时您可以设置按钮的选定状态并进行检查。

Maybe:

if(currentButton.highlighted){

}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM