开发者

Iterate through all images

开发者 https://www.devze.com 2023-04-04 01:53 出处:网络
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...

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

精彩评论

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