我有以下問題:UITouch降落公認的移動事件
如果我點擊用一個手指在觸摸屏(即中指),靠近時刻手指是怎麼回事了,我用第二挖掘手指(即食指)接近另一手指所在的區域,而不是發生向下的事件,我將第一根手指移動到第二根手指的下方位置。複製是有點棘手,但它是可重複的。
我有一個UIView和用於觸摸我有以下:
- (void) touchesBegan: (NSSet *) touches withEvent: (UIEvent *) event
{
for (UITouch *touch in touches) {
int index = (int)touch;
CGPoint position = [touch locationInView:self];
NSLog(@"DOWN %d x:%f y:%f", index, position.x, position.y);
}
}
- (void) touchesMoved: (NSSet *) touches withEvent: (UIEvent *) event
{
for (UITouch *touch in touches) {
int index = (int)touch;
CGPoint position = [touch locationInView:self];
NSLog(@"MOVE %d x:%f y:%f", index, position.x, position.y);
}
}
- (void) touchesEnded: (NSSet *) touches withEvent: (UIEvent *) event
{
for (UITouch *touch in touches) {
int index = (int)touch;
CGPoint position = [touch locationInView:self];
NSLog(@"UP %d %f %f", index, position.x, position.y);
}
}
當我再現它我有以下輸出
DOWN 510365696 x:891.500000 y:197.000000
MOVE 510365696 x:774.000000 y:263.000000
MOVE 510365696 x:766.000000 y:268.500000
UP 510365696 764.500000 270.000000
其中上述MOVE是的下降位置第二根手指。正如你也可以看到從第一個手指應該是在位置(891,197)的UP完全丟失...
我知道我可以檢測到這些「跳躍」,但沒有辦法區分他們從快速移動的手指。
我很感激任何幫助。
事情是我需要精度和多點觸控。這兩個手指就是我給我解釋我的問題的一個例子。在我的情況下,我將在固定距離進行兩次觸摸,這可能會消失/重現,因此上述問題是不需要的行爲或硬件限制。 – thodoris
@thodoris我編輯了我的答案。檢查這是否工作。 – GoGreen
感謝您的建議,但我已經啓用此選項。多點觸控一般效果很好,但這是一種極端情況。我認爲發生的事情是,我上面描述的這兩個手指手勢由於速度很快而被誤解爲快速手指移動。在手指快速移動時,手指不會跟隨連續的位置,只是相鄰。通過用我的手指快速做到這一點,我可以「欺騙」硬件。我將不得不爲它找到解決方法,最終這是我得到的輸入,我無法控制它,只是如何解釋它。 – thodoris