why is there a delay when moving object using UIPanGestureRecognizer

前端 未结 3 530
时光说笑
时光说笑 2021-02-04 05:44

I\'m moving UIView object using UIPanGestureRecognizer - how much I drag my finger on screen, that much I move the view in the same direction (only in X - left or right, Y is no

3条回答
  •  日久生厌
    2021-02-04 06:06

    The GestureRecognizer can't be sure, if it is a pan gesture, before you moved your finger some pixels. I don't know the exact tolerance value, but that is why you feel a delay.

    Documentation:

    A panning gesture is continuous. It begins when the minimum number of fingers allowed have moved enough to be considered a pan.

    If you want instant movement, you probably need to build your own logic using touchesMoved:.

    Another approach could be, to animate to the first recognized point. But that doesn't remove the delay. For that approach you could have a look at my JDDroppableView on github.

提交回复
热议问题