开发者

Nested UITapGestureRecognizers

开发者 https://www.devze.com 2023-02-02 16:38 出处:网络
If I have several views stacked one on top of the other (all subviews of each other) where each one开发者_如何学运维 has a UITapGestureRecognizer attached to it.

If I have several views stacked one on top of the other (all subviews of each other) where each one开发者_如何学运维 has a UITapGestureRecognizer attached to it.

How can I make sure that the highest visible view received the gesture and not the furthest ancestor?


The tap gesture is only valid for the current view. Further the frame of your current view(-controller). You can create a blank view over the hole screen and put in there your current view lets say 200x200 px. (essentially it is both in the same view)
Now all gestures should respond to your topmost view-controller. The bad thing about that: you can't access the views below anymore.

0

精彩评论

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