Guest User

Untitled

a guest
Dec 18th, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. CGPoint velocity = [recognizer velocityInView:self.cardView];
  2.  
  3. if (fabs(velocity.y) > fabs(velocity.x)) {
  4. //vertical motion
  5. }
  6. else if (fabs(velocity.x) > fabs(velocity.y)) {
  7. //horizontal motion
  8. CGPoint translation = [recognizer translationInView:self.cardView];
  9.  
  10. recognizer.view.center = CGPointMake(recognizer.view.center.x + translation.x,
  11. recognizer.view.center.y);
  12. [recognizer setTranslation:CGPointMake(0, 0) inView:self.cardView];
  13. }
Add Comment
Please, Sign In to add comment