当用户触摸视图时,我想检测只是双击/单击。
我做了这样的事情:
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
UITouch *touch = [touches anyObject];
CGPoint prevLoc = [touch ]
if(touch.tapCount == 2)
NSLog(@"tapCount 2");
else if(touch.tapCount == 1)
NSLog(@"tapCount 1");
}
但它总是在 2 次点击之前检测到 1 次点击。我怎样才能检测到 1 / 2 水龙头?