Skip to content

Instantly share code, notes, and snippets.

@sebk
Created September 10, 2012 13:43
Show Gist options
  • Save sebk/3691003 to your computer and use it in GitHub Desktop.
Save sebk/3691003 to your computer and use it in GitHub Desktop.
UIPanGestureRecognizer - determine direction
CGPoint velocity = [gestureRecognizer velocityInView:currentView];
if (velocity.x * lastGestureVelocity.x + velocity.y * lastGestureVelocity.y > 0) {
//NSLog(@"gesture went in same direction");
}
else {
NSLog(@"gesture went in opposite direction");
}
lastGestureVelocity = velocity;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment