手势速度
有时候需要根据手势滑动的速度进行一定量的特殊处理,比如,在项目中有一个当前控制器下滑返回,这时候会根据下滑速度判断用户是否有需要返回的意图.
- (void)panGestureHandler:(UIPanGestureRecognizer *)gesture {
CGPoint translation = [gesture translationInView:gesture.view];
if (gesture.state == UIGestureRecognizerStateEnded) {
CGPoint speed = [gesture velocityInView:gesture.view];
NSLog(@"滑动速度:%@", NSStringFromCGPoint(speed));
}
}