开发者

Miss a single tap randomly

I have the following code snippets

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

    UITouch *touch = [touches anyObject];开发者_StackOverflow中文版
    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%?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜