在Cocos2d中,当使用self.isTouchEnabled
启用触摸时,我可以使用这样的方法:
-(void)ccTouchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
但是,由于某种原因,这个不起作用:
-(void)ccTouchEnded:(UITouch *)touch withEvent:(UIEvent *)event
这是为什么?
最佳答案
我没有看到你的代码,所以我不知道你是否注册了
CCTouchDispatcher
如何注册:
[[CCTouchDispatcher sharedDispatcher] addTargetedDelegate:self priority:0 swallowsTouches:YES];
如何取消注册/删除以节省内存:
[[CCTouchDispatcher sharedDispatcher] removeDelegate:self];
关于ios - Cocos2d .isTouchEnabled 不调用单点触摸方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10677366/