tags:

views:

15

answers:

1

I can initialize or create a new CCSprite object using the following code:

NSString *fileName = [[imagesPath objectAtIndex:i] lastPathComponent];
        CCSprite *sprite = [CCSprite spriteWithFile:fileName];

Now, is there anyway to later find out the name of the image file used for the particular CCSprite object?

UPDATE 1:

userData property looks interesting!

+1  A: 

No. CCSprite is not retaining the filename.

But like you noticed, you can hang whatever you want off the userData property -- make sure you manage its lifetime properly. Other options are to use subclassing or composition with CCSprite and your other game classes so that you can keep track of additional data.

Hitesh