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.
精彩评论