最佳答案
我正在检测用户是否按下了2秒:
UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc]
initWithTarget:self
action:@selector(handleLongPress:)];
longPress.minimumPressDuration = 2.0;
[self addGestureRecognizer:longPress];
[longPress release];
这是我处理长按的方法:
-(void)handleLongPress:(UILongPressGestureRecognizer*)recognizer{
NSLog(@"double oo");
}
当我按下超过2秒时,文本“double oo”会打印两次。为什么会这样?我该如何解决?