我想根据用户滚动的速度来调用或不调用方法。
它必须在用户手指移动时立即进行测量,因为该方法需要在第二次开始移动时被调用或忽略,而不是在停止时。
这适合我。
CGPoint scrollVelocity = [[self.tableView panGestureRecognizer] velocityInView:self.tableView];
NSLog(@"scroll velocity : %f",scrollVelocity.y);
此方法公开速度值。它是滚动视图委托的一部分。
optional func scrollViewWillEndDragging(_ scrollView: UIScrollView,
withVelocity velocity: CGPoint,
targetContentOffset: UnsafeMutablePointer<CGPoint>){
}