Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save chancyWu/98df8c44e65727cae580 to your computer and use it in GitHub Desktop.
Save chancyWu/98df8c44e65727cae580 to your computer and use it in GitHub Desktop.
Forward Touches and Gestures to Views from UIScrollView
// 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