Reputation: 13551
I'm just getting into UIView touch events and I'm not sure how to get the UIView that actually received the touch.
I have a UIScrollView with multiple UIImageViews in it. Each UIImageView has a touch listener. I would like to get the UIImageView that receives the touch.
Thanks!
Upvotes: 0
Views: 203
Reputation: 535201
I'm not sure what you think a "touch listener" is, but the way to do this, if you want to detect something like a tap on an image, is to give every image view a gesture recognizer and give each gesture recognizer an action target and handler. When a tap happens, the gesture recognizer passes itself to its action handler. In the action handler, examine the gesture recognizer's view
.
Upvotes: 1