Skip to content

Instantly share code, notes, and snippets.

@modamoda
Created January 30, 2015 09:32
Show Gist options
  • Save modamoda/e09f46d1850155a94519 to your computer and use it in GitHub Desktop.
Save modamoda/e09f46d1850155a94519 to your computer and use it in GitHub Desktop.
iOS UIScrollView: How to detect scrolling direction
// http://stackoverflow.com/a/21806997/893945
@interface MyViewController : UIViewController <UIScrollViewDelegate>
@end
@implementation MyViewController
- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView
{
if([scrollView.panGestureRecognizer translationInView:scrollView.superview].y < 0) {
// up
} else {
// down
}
}
@dourgulf
Copy link

not work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment