views:

489

answers:

2

how do i count double tap in simulator?

+1  A: 

Implement one of the touch functions defined in UIResponder (touchesBegan, touchedEnded, etc...). When you get the touches array, you can get a UITouch's tap count using code like this:

UITouch * t = [touches anyObject];
NSLog(@"%d", [t tapCount]);
Ben Gotow
it always show one in simulator
Rahul Vyas
Hey! Sorry if this is stupid - but you quickly clicked twice in the same place on the screen, right? It should work in both the simulator and the device.
Ben Gotow
+3  A: 
- (void) touchesBegan:(NSSet *) touches withEvent:(UIEvent *) event
{
    UITouch *touch = [touches anyObject];
    if (touch.tapCount == 2)
    {
        // do your stuff here
    }
}
Marco Mustapic