开发者

How do you disable touch to screen without using beginIgnoringInteractionEvents?

开发者 https://www.devze.com 2023-04-03 22:11 出处:网络
from a similar question/answer You could always put a transparent UIView over top of the area you want to \"disable\" tap input for, have it listen for taps, and have it

from a similar question/answer

You could always put a transparent UIView over top of the area you want to "disable" tap input for, have it listen for taps, and have it ignore them. Remove the UIView (or hide it) when you want input to be listened to again.

Now, I can understand the strategy, but would someone enlighten me with a code?

How do you make a view

1. listen for taps

2. have it ignor开发者_JS百科e them

Would it not pass touch to views behind it?


Set a plain UIView's userInteractionEnabled property to YES, but don't have any code in there to respond to touch events. The view will then 'swallow' all touches.

0

精彩评论

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

关注公众号