未按正确顺序接收iOS触摸事件(触摸结束未在正确的时间调用)

时间:2011-12-02 20:08:28

标签: ios uitouch

所以我试图按照这个确切的顺序捕获以下行为

touch 1 STARTED
touch 1 moved
touch 1 moved

touch 2 STARTED
touch 2 moved
touch 2 ENDED

touch 1 moved
touch 1 moved
touch 1 ENDED

但他们却以错误的顺序回来了:

2011-12-02 14:55:37.187 coreplotround2[7396:707] touch 1 STARTED
2011-12-02 14:55:41.182 coreplotround2[7396:707] touch 1 moved
2011-12-02 14:55:41.582 coreplotround2[7396:707] touch 1 moved

2011-12-02 14:55:41.743 coreplotround2[7396:707] touch 2 STARTED
2011-12-02 14:55:41.902 coreplotround2[7396:707] touch 1 moved
2011-12-02 14:55:41.904 coreplotround2[7396:707] touch 2 moved <---- at this point my 2nd finger is released!!

2011-12-02 14:55:45.533 coreplotround2[7396:707] touch 1 moved
2011-12-02 14:55:45.533 coreplotround2[7396:707] touch 1 moved
2011-12-02 14:55:45.533 coreplotround2[7396:707] touch 1 moved
2011-12-02 14:55:45.533 coreplotround2[7396:707] touch 1 moved
2011-12-02 14:55:45.533 coreplotround2[7396:707] touch 1 moved
2011-12-02 14:55:45.549 coreplotround2[7396:707] touch 1 ENDED
2011-12-02 14:55:45.566 coreplotround2[7396:707] touch 2 ENDED

问题是触控2 ENDED与触控1 ENDED同时发生,即使触控2早些时候结束了。

我正在使用touchesBegan,touchesMoved,touchesEnded等方法。

任何人都知道为什么?

1 个答案:

答案 0 :(得分:0)

我发现了原因。我从Core Plot图形库中继承了一个对象。这个对象是UIView的子类,所以我希望它能够接收到触摸。因此,我重新宣布了触摸听众并尝试了解他们的表现。

我相信在这个特定的Core Plot对象中发生了一些奇怪的事情,它正在触及触摸的顺序。我无法告诉你这是什么。

我通过创建一个空视图并测试多点触控的新项目来发现这一点。

我决定在其上创建一个UIView来截取多个部分,然后在Core Plot中调用相应的委托。而不是子类化Core Plot。