The issue lies in how touches are reported in that method. The NSSet touches
in that method contains one or more instances of UITouch, and each UITouch instance represents touch events from a single finger on the screen. So if the user touches the screen with two fingers, the touches
set will contain two UITouch objects.
The issue is that a single UITouch may have multiple taps without being considered multiple UITouches. If the device detects two taps (finger down and up without significant motion) in roughly the same location, it will combine them into a single UITouch containing multiple taps. In this case, you use the tapCount
selector on UITouch to figure out how many taps that touch had.
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
NSLog(@"Got %u touches", [touches count]);
for(UITouch *touch in touches) {
NSLog(@"Touch had %u taps", [touch tapCount]);
}
}
For more info: