UITouch *touch = [event.allTouches anyObject];
BOOL tappedTwice = NO;
if ([touch tapCount] == 2) {
tappedTwice = YES;
NSLog(@"double touch");
}
else if ([touch tapCount] == 1 && !tappedTwice) {
NSLog(@"single touch");
}
但它检测到单次触摸,并且在它加倍之后,但在我的情况下它是不正确的。你有什么想法吗?
答案 0 :(得分:2)
检查link。只需通过设置
配置所需的点击次数[tapGestureRecognizer setNumberOfTapsRequired:2];
然后处理此方法
- (void)handleTap:(UITapGestureRecognizer *)sender {
if (sender.state == UIGestureRecognizerStateEnded) {
// handling code
}
}