I'm working on an app where most of the touch gestures will be pan gestures (but I'm not using a pan gesture recognizer). I'm using UIGestureRecognizerDelegate
and using touchesBegan
, touchesMoved
, touchesEnded
, and touchesCancelled
. However, there are a couple of spots on the screen where if a pan starts there I want to recognize it as a tap event instead. I can do this by simply recognize the location in touchesBegan. My question is, can I dealloc the touch at that point to prevent the continuation of the pan? If a pan starts from this location in the screen, it's guaranteed not to really be intended as a pan by the user. I hope this makes sense.
EDIT: I've realized the extra overhead of managing a tap even for a point that should be ignored is insignificant, so I think I'll just do that. I'll keep the question here, though, in case there is a way to stop the gesture from continuing to be tracked.
I also need a suggestion for how to handle the following situation.
Suppose the user starts a pan (not in the area just described, but elsewhere where it really is intended to be a pan), and while the pan is proceeding, another pan is started elsewhere on the screen. How do I recognize this situation?
EDIT: I am now testing whether this code will solve this issue:
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
return YES;
}
Edit: ARC forbids explicit dealloc, so now I revise my question to a more general one of what, if anything, I can do to suppress further action. Or do I just have to deal with it?