i’m using v99.0
onEnter is not being called when my sprite is added to the layer and the layer’s scenee is displayed. the sprite appears correctly but onenter is not being called.
the funny thing is that i’m doing exactly the same with other sprites and their onenter methods are being called fine.
Is this a bug?
In app delegate:
[[CCDirector sharedDirector] runWithScene: [TilesView scene]];
In init method of TilesView (which is a subclass of CClayer):
CCSpriteTouch *backArrow = [CCSprite spriteWithFile:@”back arrow.png”];
[self addChild:backArrow];
Note: In the same init method i create other sprites which does result in their onEnter methods being called:
TileSprite *tile = [TileSprite spriteWithFile:@"singleTile.png"];
[self addChild:tile];
the code for both sprite classes is identical.
I spotted it… sorry, it was a silly mistake. I had subclassed CCSprite for use with touches but when I created an instance of the class i did so with CCSprite not my custom class:
so CCSprite‘s onenter method was being called, not CCSpriteTouch‘s.