I\'ve playing around with recognizing the touches in an iOS Application, and I have this simple code
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent
Inside info:
I am using:
- 1 finger UITapGestureRecognizer
- 1 finger UILongPressGestureRecognizer
- 1 finger double tap UITapGestureRecognizer
- 2 fingers tap UITapGestureRecognizer
- 1 UIPinchGestureRecognizer
And also should receive one finger panning. But what i have found out is that the Pinch gesture was not Ending even if the user had risen one finger. Somehow iOS is still calling the Pinch's selector with "Changed" state.
My solution was to use the touchesBegin/Moved/Ended to catch the pan and use the number of active touches as safety check in case the pinch selector would be called.
Other settings i had to use in making the above configuration:
self.multipleTouchEnabled = YES;
[oneFingerTapRecognizer requireGestureRecognizerToFail:oneFingerLongPressRecognizer];
[oneFingerTapRecognizer requireGestureRecognizerToFail:oneFingerDoubleTapRecognizer];
[oneFingerLongPressRecognizer requireGestureRecognizerToFail:oneFingerDoubleTapRecognizer];
[twoFingersTapRecognizer requireGestureRecognizerToFail:twoFingersPinch];