1

I want that when the user has two fingers touching the screen, two separate UILongPressGestureRecognizers recognize the gesture for each finger (1 recognizer for 1 finger). I could use a single UILongPressGestureRecognizer with numberOfTouchesRequired set to 2, but I need the 2 touches to be recognized independently (ex: I can release one finger and the other recognizer will remain active, which is not possible with a single gesture recognizer).

Thanks for your help.

Karim
  • 46
  • 3

1 Answers1

2

To allow both gestures to work together, implement the following delegate method:

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer{
    return YES;
}

To make it so that the long press has first priority, do:

[tapGesture requireGestureRecognizerToFail:longPress];
Rajesh
  • 624
  • 13
  • 20