Is there a way to print all objects contained in my scene’s sharedSpriteFrameCache in the console? Something using NSLog or CCLOG?
I have this in my scene, and want it to print the names of the frames as they appear in the plist.
[[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile:@"samplesprites.plist"];
Normally I’d write what I’ve already tried here, but I haven’t found anything referencing a way to access the sprite frame names, or keys, or objects, or whatever for the sharedSpriteFrameCache.
EDIT: I probably should elaborate on the fact that I do know the frame names are in the plist file, however, I’m encountering an error where the console says my frame name doesn’t exist, but I know it does. I’ve found various work-arounds for it, but this is more of a curiosity question for the troubleshooting approach that I’m trying to use. The requested technique may not have any real use, but, can it actually be done?
Ricard answered this question in his comment, but here’s the elaboration:
If you go into the Cocos2d folder under libs, you’ll find
CSpriteFrameCache.handCCSpriteFrameCache.m.Change your CCSpriteFrameCache.h file to include this additional line:
Then, in CCSpriteFrameCache.m, add this:
Then wherever in your code you want to have the sprite frames currently in your cache displayed, enter this:
Answer attributed to this link: http://www.cocos2d-iphone.org/forum/topic/31060