If you have a view in your IPhone application, there are both a click and a double-click operation. When a user double-clicks a view, it always performs a click action before double-clicking. Therefore, direct judgement will find that you can not directly into the double-click operation. Here's how to tell if touch events are clicked or double-clicked
-(void) singletap{
NSLog (@ "Tap 1 time");
}
-(void) doubletap{
NSLog (@ "Tap 2 Time");
}
-(void) Touchesbegan: (Nsset *) touches withevent: (Uievent *) event {
Uitouch *touch = [touches anyobject];
Nstimeinterval delaytime = 0.4;//to adjust
switch (touch.tapcount) {case
1:
[self performselector:@ Selector (SINGLETAP) Withobject:nil afterdelay:delaytime];
break;
Case 2:{
[nsobject cancelpreviousperformrequestswithtarget:self selector: @selector (SINGLETAP) Object:nil];
[Self performselector: @selector (DOUBLETAP) Withobject:nil afterdelay:delaytime];
}
break;
Default: Break
;
}
}
The above is a small series to introduce the iOS touch event to distinguish between click and double-click the response method, I hope to help you, if you have any questions welcome to my message, small series will promptly reply to everyone!