Objective c 如何在COCOS2D3.0中添加触摸调度器

Objective c 如何在COCOS2D3.0中添加触摸调度器,objective-c,cocos2d-iphone,Objective C,Cocos2d Iphone,这是2.0版中的旧方法。 但是它说(在3.0中):没有CCDirector的可见界面,用于选择器touchDispatcher在3.0中没有touchDispatcher 检测触摸的新方法是: [[[CCDirector sharedDirector] touchDispatcher] addTargetedDelegate: self priority:0 swallowsTouches:YES]; 一定要加上 -(void) touchBegan:(UITouch *)touch

这是2.0版中的旧方法。
但是它说(在3.0中):
没有CCDirector的可见界面,用于选择器touchDispatcher

在3.0中没有touchDispatcher

检测触摸的新方法是:

[[[CCDirector sharedDirector] touchDispatcher] addTargetedDelegate:
    self priority:0 swallowsTouches:YES];
一定要加上

-(void) touchBegan:(UITouch *)touch withEvent:(UIEvent *)event{

}
如果要检测区域中的触摸,请执行以下操作:

[self setMultipleTouchEnabled:YES];
如果你想追踪每一次触摸或计算你有多少次触摸,你需要制作一个数组,当触摸开始时,将其添加到数组中,当触摸结束时,将其删除

希望这有帮助

CGPoint touchLocation = [touch locationInNode:NODE];