如何在iOS应用中启用多次触摸? [英] How to enable multiple touches in an iOS app?
本文介绍了如何在iOS应用中启用多次触摸?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是代码:
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
if ([touches count] == 1) {
// code
} else {
// code
}
}
当我使用模拟器中的Option键模拟双击时,代码总是选择我的if语句的第一部分,就像只收到了一次触摸一样.
When I simulate the double tap with the Option key in simulator, the code always chooses the first part of my if statement, as if there were only 1 touch received.
为什么我没有同时收到两个触摸?
Why am I not receiving both touches?
推荐答案
The multipleTouchEnabled
property needs to be set to YES before the view can accept multitouch.
这篇关于如何在iOS应用中启用多次触摸?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文