Last active
August 29, 2015 14:02
-
-
Save chancyWu/98df8c44e65727cae580 to your computer and use it in GitHub Desktop.
Forward Touches and Gestures to Views from UIScrollView
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// in your subclass of UIScrollView | |
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event | |
{ | |
if (!self.dragging) { | |
[self.nextResponder touchesBegan:touches withEvent:event]; | |
} | |
else { | |
[super touchesBegan:touches withEvent:event]; | |
} | |
} | |
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event | |
{ | |
if (!self.dragging) { | |
[self.nextResponder touchesMoved:touches withEvent:event]; | |
} | |
else { | |
[super touchesMoved:touches withEvent:event]; | |
} | |
} | |
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event | |
{ | |
if (!self.dragging) { | |
[self.nextResponder touchesEnded:touches withEvent:event]; | |
} | |
else { | |
[super touchesEnded:touches withEvent:event]; | |
} | |
} | |
- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event | |
{ | |
if (!self.dragging) { | |
[self.nextResponder touchesCancelled:touches withEvent:event]; | |
} | |
else { | |
[super touchesCancelled:touches withEvent:event]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment