我有一个启用触摸的 CCLayer 类和以下方法:
-(void)ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event;
-(void)ccTouchesEnded:(NSSet *)touches withEvent:(UIEvent *)event;
如果我反复快速点击 iPad 屏幕,它会崩溃——但不会到获取堆栈跟踪的地步……它会冻结……控制台将显示:
2012-10-17 08:43:06.445 game[5432:607] cocos2d: animation stopped
2012-10-17 08:43:06.448 game[5432:607] cocos2d: animation started with frame interval: 4.00
2012-10-17 08:43:07.075 game[5432:607] cocos2d: animation stopped
2012-10-17 08:43:07.081 game[5432:607] cocos2d: animation started with frame interval: 60.00
2012-10-17 08:43:12.557 game[5432:607] cocos2d: animation stopped
2012-10-17 08:43:12.561 game[5432:607] cocos2d: animation started with frame interval: 4.00
有没有办法限制 ccTouchesBegan/ccTouchesEnded 方法的速率?如果我删除了这些事件处理程序中的所有代码,甚至会发生这种情况——只是超频繁地触发该方法的行为似乎使一切陷入困境。