I have a UIImage view that responds to touch events. I want to cancel the touch sequence, i.e., further calls to touchesMoved:, if the touch goes o
You need to call [super touchesMoved:withEvent:] in order to let the super view clean up from the event but more importantly, you need to not call [super touchesCancelled:withEvent:].
Here's what I used on a cell to keep it from getting selected when I detected a swipe:
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
if (!showingEdit) {
if (IS_FAR_ENOUGH_TO_BE_A_SWIPE) {
RESPOND_TO_SWIPE
showingEdit = YES;
[super touchesCancelled:touches withEvent:event];
} else {
[super touchesMoved:touches withEvent:event];
}
}
}
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
if (!showingEdit) {
[super touchesEnded:touches withEvent:event];
}
}