Search code examples
ioscocos2d-iphone

How to get frame name from CCSpriteFrame?


There is part of my code I check current CCSpriteFrame and I would like to get the frame name of it

There is no property or method to retrieve it as far I looked around and in the documentation

thanks


Solution

  • In v3 there is textureFilename: http://www.cocos2d-swift.org/docs/api/Classes/CCSpriteFrame.html#//api/name/textureFilename

    In v2 there's nothing of this kind, you'd have to either create a mapping between frame names and frame objects (pointers) or hack CCSpriteFrame so that it remembers the frame name it was initialized with.