我正在检测用户是否已按下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”被打印两次。为什么是这样?我该如何解决?