我已添加此功能。'sharedDispatcher'已弃用
- (void) registerWithTouchDispatcher {
[[CCTouchDispatcher sharedDispatcher] addTargetedDelegate:self priority:0 swallowsTouches:YES];
}
错误:sharedDispatcher
已被弃用
这是什么意思和我怎么办?
我已添加此功能。'sharedDispatcher'已弃用
- (void) registerWithTouchDispatcher {
[[CCTouchDispatcher sharedDispatcher] addTargetedDelegate:self priority:0 swallowsTouches:YES];
}
错误:sharedDispatcher
已被弃用
这是什么意思和我怎么办?
看看ccDeprecated.h
,上面写着使用方法:
[[CCDirector sharedDirector] touchDispatcher]
变化: [CCTouchDispatcher sharedDispatcher] addTargetedDelegate:自我优先级:0 swallowsTouches:YES];
收件人: [[[CCDirector sharedDirector] touchDispatcher] addTargetedDelegate:self priority:0 swallowsTouches:YES];
通过按'Shift + Command'键并悬停在方法上,您可以检查任何Cocos(CC)方法背后的Cocos2D代码。对任何被弃用的方法这样做会带你到CCDeprecated.m,这也会给你新的方法。
不错!我不知道ccDeprecated.h甚至存在。感谢您指出了这一点。希望用户在那里会接受你的答案。 – CaldwellYSR
哇。谢谢!我不知道这个文件是否存在,这有助于很多 –