开发者

How can a disabled button get touches?

开发者 https://www.devze.com 2022-12-20 22:43 出处:网络
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 acti

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 preven开发者_Go百科t this ?

Thanks ....


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消