jeudi 7 juillet 2016

What is the difference between Pan and Swipe in iOS?


Sounds simple .. Hold the Trackpad, move the finger, release .. But somehow swipe is not being triggered (pan is triggered instead)

UISwipeGestureRecognizer *swipeGesture = [[UISwipeGestureRecognizer alloc] 
      initWithTarget:v action:@selector(handleSwipe:)];
swipeGesture.direction= UISwipeGestureRecognizerDirectionUp;
[v addGestureRecognizer:swipeGesture];

Pan is recognized by the above sequence instead.

UIPanGestureRecognizer *panGesture = [[UIPanGestureRecognizer alloc] 
      initWithTarget:v action:@selector(handlePan:)];
[v addGestureRecognizer: panGesture];

If pan is commented, swipe is recognized by the same gesture .. With this, 2 questions:

  • What is the difference then between a pan and a swipe?
  • How can one simulate a swipe on iPhone simulator?

Aucun commentaire:

Enregistrer un commentaire