这是启用了多个触摸的视图的 touchesBegan 方法。
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch* touch = [touches anyObject];
if ([touches count] > 1)
NSLog(@"multi touches: %d fingers", [touches count]);
NSUInteger numTaps = [touch tapCount];
if (numTaps == 1) {
NSLog(@"single tap");
} else {
NSLog(@"multi tap: %d", numTaps);
}
}
我似乎从来没有记录过多点触控。只需单击和双击。我认为它就像获得触摸计数一样容易,我错了吗?