我设置了UILongPressGestureRecognizer
numberOfTouchesReguired = 2
。如何在视图上获得每个手指的连续坐标?
目前我有这个,但它似乎将所有触摸的位置合并为1个坐标。
- (void)handleLongPress:(UILongPressGestureRecognizer *)sender { CGPoint locationInView = [sender locationInView:nil]; }
答案 0 :(得分:8)
请参阅UIGestureRecognizer
的文档。它提供了以下方法:
- (void)handleLongPress:(UILongPressGestureRecognizer *)sender {
if (sender.state == UIGestureRecognizerStateChanged) {
NSUInteger *touchCount = [sender numberOfTouches];
for (NSUInteger t = 0; t < touchCount; t++) {
CGPoint point = [sender locationOfTouch:t inView:sender.view];
}
}