When I use the
self.isTouchEnabled = YES
在Cocos2d v2.0中,若要触摸层,则Xcode会给出提示:
setIsTouchEnabled: is deprecated
现在,我只是想知道isTouchEnabled的替代方法。
When I use the
self.isTouchEnabled = YES
setIsTouchEnabled: is deprecated
这是新代码:
self.touchEnabled = YES; //In Cocos2d 2.0
self.userInteractionEnabled = YES; //In Cocos2d 3.0
我只是在想,为什么那些天才(Cocos2d团队)会做出这种愚蠢的改变!
但在Cocos2d 2.x及以上版本中设置触摸事件确实是正确的选择!!!
现在似乎setIsTouchEnabled
位于“CCDeprecated.h”中。
以下方法在当前的“CCLayer.h”中:
[self setTouchEnabled:YES]