在我的 UIView
子类中我有这个:
- (void) touchesBegan: (NSSet*) touches withEvent: (UIEvent*) event
{
UITouch* touch = [touches anyObject];
CGPoint location = [touch locationInView: self];
NSLog(@"touches count: %i",[touches count]); //always shows 1
}
无论我用多少根手指触摸屏幕,我都只会得到“1”作为输出。我还将上面的内容添加到 touchesMoved
中,结果相同。
最佳答案
您是否启用了多点触控选项?
[(your uiview) setMultiTouchEnabled:YES];
默认情况下为 false,这会将您 View 上的所有触摸转换为所有其他触摸中间的一次触摸。
将它设置为 YES
将使您的 View 接收屏幕上每个手指(或笔)的一次触摸事件
关于iphone - 无法检索同时触摸的数量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14750216/