1

I attached a custom UIGestureRecognizer to one UIView which fills almost the whole screen. This view contains a small subview which needs to receive normal touches as well.

Problem: Touches started on this subview are not handled by the recognizer attached to its parent.

I want the gestureRecognizer to be first priority and work even if the subview is touched. How can I forward all touches started on this subview to its parent as well in order that my gestureRecognizer can do its job?

weezor
  • 2,621
  • 1
  • 16
  • 10

1 Answers1

4

I found the solution! It's actually quite simple.

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
     // Forward this message up the responder chain
     [super touchesBegan:touches withEvent: event];
}

The call to super in touchBegan of the subview is all it takes. Found it on this blog Allow superview to recieve events caught by subview

weezor
  • 2,621
  • 1
  • 16
  • 10