iPhone UIScrollView Speed Check

后端 未结 8 1650
梦如初夏
梦如初夏 2020-11-30 19:31

I know how to get the contentOffset on movement for a UIScrollView, can someone explain to me how I can get an actual number that represents the current speed of a UIScrollV

8条回答
  •  余生分开走
    2020-11-30 20:05

    There's an easier way: check the UISCrollview's pan gesture recognizer. With it, you can get the velocity like so:

    CGPoint scrollVelocity = [[_scrollView panGestureRecognizer] velocityInView:self];
    

提交回复
热议问题