Cocos2d 2.0中“self.isTouchEnabled”的替代方法是什么?

时间:2013-01-13 14:56:07

标签: ios cocos2d-iphone

当我使用

self.isTouchEnabled = YES
可以触摸Cocos2d v2.0中的

,Xcode会给我一个提示:

setIsTouchEnabled: is deprecated

现在,我只想知道isTouchEnabled的替代方法。

2 个答案:

答案 0 :(得分:41)

这是新代码:

    self.touchEnabled = YES; //In Cocos2d 2.0

    self.userInteractionEnabled = YES; //In Cocos2d 3.0

只是想知道为什么天才人(Cocos2d团队)做这种愚蠢的改变

但是这个是在Cocos2d 2.x及以上版本中设置触摸的正确调用!!!

答案 1 :(得分:7)

现在setIsTouchEnabled似乎位于“CCDeprecated.h”中。

以下方法在当前的“CCLayer.h”中:

[self setTouchEnabled:YES]
相关问题