當你有這樣的問題時,最好的辦法就是實現回調,並在實現中記錄參數。例如:
- (BOOL)ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
// Log everything (there will be repetition because the event contains the set of touches):
NSLog(@"ccTouchesBegan: touches = %@; event = %@", touches, event);
// Or, just log the number of touches to simplify the output:
NSLog(@"ccTouchesBegan: %d touches", [touches count]);
return kEventHandled;
}
然後只需運行您的應用程序和實驗,看日誌。你會通過這種方式學習更多(並且更快),而不是通過在這裏詢問。
但是,爲了回答您的具體問題:
你應該得到一個呼叫ccTouchesBegan對於每個抽頭(即使第一指仍然下跌當第二次敲擊時)。如果兩個手指同時擊中,您將通過兩次觸摸獲得一個呼叫。
每當一個或多個手指移動時,您都會重複調用ccTouchesMoved。如果只有一個手指正在移動,每次呼叫都會通過一次觸摸。靜止的手指在移動或擡起之前不會產生事件。
當然,記得設置isTouchEnabled = YES
您CCLayer否則您將無法在所有得到任何回調。