您可以通过捕获 UILongPressGestureRecognizer 的当前状态来检测长按后手指的移动。例如:
识别器声明:
UILongPressGestureRecognizer* Long = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longPressDetected:)];
方法实现:
-(void)longPressDetected:(UILongPressGestureRecognizer*)Long{
switch ([Long state]) {
case UIGestureRecognizerStatePossible:
break;
case UIGestureRecognizerStateBegan:
NSLog(@"Got it!")l // Long press is successfully recognized
break;
case UIGestureRecognizerStateChanged:
NSLog(@"Wow! Its moving!"); // finger position has changed
break;
case UIGestureRecognizerStateEnded:
default:
break;
}
}