Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the alternative method for the "self.isTouchEnabled " in Cocos2d 2.0?

When I use the

self.isTouchEnabled = YES

in Cocos2d v2.0 for the layer could be touched,the Xcode give me a tip:

setIsTouchEnabled: is deprecated

Now, I just want to know alternative method for isTouchEnabled.

like image 313
Vienta Avatar asked Jan 13 '13 14:01

Vienta


2 Answers

Here is new code:

    self.touchEnabled = YES; //In Cocos2d 2.0      self.userInteractionEnabled = YES; //In Cocos2d 3.0 

Just wondering why genius people(Cocos2d team) doing this kind of silly change!

But this one is the right call to setup touch in Cocos2d 2.x and above !!!

like image 150
Guru Avatar answered Nov 22 '22 07:11

Guru


It seems the setIsTouchEnabled is located in "CCDeprecated.h" now.

The following method is in the current "CCLayer.h":

[self setTouchEnabled:YES] 
like image 31
John McCormick Avatar answered Nov 22 '22 06:11

John McCormick