views:

262

answers:

1

How do I know on which of the the child views an event occurred when using UIGestureRecognizers?

According to the documentation:

A gesture recognizer operates on touches hit-tested to a specific view and all of that view’s subviews.

As far as I can see, the 'view' property is

The view the gesture recognizer is attached to.

which will be the parent view.

+1  A: 
UIView* view = gestureRecognizer.view;
CGPoint loc = [gestureRecognizer locationInView:view];
UIView* subview = [view hitTest:loc withEvent:nil];
KennyTM