开发者

Iterate through all images

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜