views:

47

answers:

1

I have the following code snippets

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {

    UITouch *touch = [touches anyObject];
    NSUInteger numberTaps = [touch tapCount];

    // Tapping
    if (numberTaps > 0) {
       // do something
    }

...

The above code basically detects a single tap on a small image (width = 18 and height = 36). It works 90% of the time detecting a single tap.

But it sometime misses it (randomly). I have to tap several times before it picks up the single tap.

What did I do wrong or miss so I could consistently detect the single tap 100%?

Thanks in advance for your help.

+1  A: 

It is possible you are missing the tap because your finger isn't accurate enough to always hit the proper place on the hardware. I have small images in my app which can be tapped, and I often miss them. Try making the image larger to verify if it always works then. You can artificially make an image larger with blank space around it to make hitting it more accurate.

Nathan S.