当你有这样的问题时,最好的办法就是实现回调,并在实现中记录参数。例如:
- (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否则您将无法在所有得到任何回调。