How can a disabled button get touches?

谁说胖子不能爱 提交于 2019-12-22 23:14:25

问题


I was just wondering how can this happen. In my iPhone application during a http request loading I am disabling a button in the navigation bar. But when I touch the button three or four times the action method gets called after the loading is completed this means that even though the button is disabled the touches are detected on it and later the ibaction method is called .

So is this exceptional or is there any way to prevent this ?

Thanks ....


回答1:


Setting a UIControl disabled does not prevent it from getting touch events (and you shouldn't override -touchesBegan: etc on a UIControl anyway).

You should set the button's userInteractionEnabled property to NO to avoid the touch events.



来源:https://stackoverflow.com/questions/2326051/how-can-a-disabled-button-get-touches

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