UIPanGestureRecognizer starting point is off

前端 未结 6 1484
庸人自扰
庸人自扰 2021-01-11 19:11

I have a UIView that has a UIPanGestureRecognizer attached to it the gesture is working fine except that the starting point is not where the pan first started it is usually

6条回答
  •  灰色年华
    2021-01-11 19:51

      CGPoint beg = [panRecognizer locationInView:_scrollView];
      CGPoint trans = [panRecognizer translationInView:_scrollView];
      CGPoint firstTouch = CGPointSubtract(beg, trans);
    

    Put this code in the UIGestureRecognizerStateBegan case

提交回复
热议问题