我正在尝试为我的视图实现 UIPanGestureRecognizer。如何添加多点触控?下面是我认为的代码(UIView 的子类)。我希望能够同时知道所有触摸的位置和速度。当前代码仅打印出一次触摸的位置和速度。更改属性 minimumNumberOfTouches 和 maximumNumberOfTouches 不起作用。非常感谢您的帮助。
UIPanGestureRecognizer *panGestureRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePanGesture:)];
panGestureRecognizer.cancelsTouchesInView = NO;
[self addGestureRecognizer:panGestureRecognizer];
- (void)handlePanGesture:(UIPanGestureRecognizer *)panGestureRecognizer
{
CGPoint location = [panGestureRecognizer locationInView:panGestureRecognizer.view];
CGPoint velocity = [panGestureRecognizer velocityInView:panGestureRecognizer.view];
NSLog(@"Location: %@", NSStringFromCGPoint(location));
NSLog(@"Velocity: %@", NSStringFromCGPoint(velocity));
}