Is it possible to iterate through all the .png images that are resources in my iPhone game? Maybe having a filter to only find for me images that begin with a certain prefix...
I know it sounds weird. It is like consid开发者_JS百科ering I don't even know what images I got in my project. Well, this is more for experimentation purposes.
You use the appropriate NSBundle
for this, if this is the main bundle, this would look like this:
NSArray *allPNGs = [[NSBundle mainBundle] pathsForResourcesOfType:@"png" inDirectory:nil];
You can then iterate through the array and check the prefixes of the returned files.
精彩评论