2011-12-02 75 views
2

所以我想捕捉以下行爲在此確切順序iOS的觸摸事件(觸摸收盤沒有在合適的時間調用)

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在同一時間來觸摸1結束,即使觸摸2更早結束。

我使用的方法touchesBegan,touchesMoved,touchesEnded。

任何人都知道爲什麼嗎?

+0

用給定的信息來說並不容易。你能發表你的觸摸代碼片段嗎?此外,有時如果重疊觸摸的iPhone會很困惑,並把它們合併成一個。 –

回答

0

我發現了原因。我從Core Plot圖形庫中分類了一個對象。這個對象是UIView的一個子類,所以我期望它接受觸摸。因此,我重新聲明瞭觸摸聽衆並試圖試驗他們的表現。

我相信奇怪的事發生在這個特定的Core Plot對象中,這個對象與觸摸順序有關。我無法告訴你這是什麼。

我通過創建一個空視圖的新項目並測試多點觸控發現了這一點。

我決定在它上面創建一個UIView來截取多槽,然後在Core Plot中調用相應的委託,而不是對核心圖進行子類化。