UIButton subclass continuously highlighted after an popping up and UIAlertView

偶尔善良 提交于 2019-12-11 13:23:33

问题


I am subclassing a UIButton and detecting finger movements, if the user swipes his finger in a certain way I will pop up an UIAlerView.

All good, except that after dismissing the UIAlertView... when the user next touches the UIButton the button goes to it's highlighted state and gets stuck there, continuously highlighted, even when no finger touching it.

Pressing the button again the UIButton begins to behave normally (only highlights when touched).

So I can only presume that an alert during a swipe, screws up the process of events, the touchesEnded never firing perhaps?

If anyone has any ideas on how to 'reset' the button after the swipe so that it behaves as it should, I would be grateful.


回答1:


Are you resetting your state in touchesCancelled?



来源:https://stackoverflow.com/questions/1715841/uibutton-subclass-continuously-highlighted-after-an-popping-up-and-uialertview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!