【发布时间】:2011-11-05 15:06:32
【问题描述】:
我一直在尝试在 MKAnnotationView 子类中使用 UILongPressGestureRecognizer。有趣的是,手势识别器仅在使用两个手指/触摸时触发。
是什么阻止了手势识别器仅通过一键触发?
实施
UILongPressGestureRecognizer *pressRecognizer = [[UILongPressGestureRecognizer alloc] initWithTarget:self
action:@selector(handleLongPress:)];
pressRecognizer.minimumPressDuration = 0.25;
pressRecognizer.numberOfTapsRequired = 0;
pressRecognizer.numberOfTouchesRequired = 1;
普通UIView 中的相同实现显示了预期的一键操作行为。然而,可以使用touchesBegan: 和touchesEnded: 来获得长按手势工作我仍然很好奇这是什么原因。
【问题讨论】:
标签: ios cocoa-touch mkmapview uigesturerecognizer mkannotationview