Question

I've dragged and dropped about 30 images (and will be adding more in the near future) into my Xcode project in "Supporting Files" and I want to be able to programmatically get each name that have the extension ".PNG". Is that even possible?

Any help is much appreciated, thanks in advance!

Était-ce utile?

La solution

NSArray *pngFilePaths = [[NSBundle mainBundle] pathsForResourcesOfType:@"PNG" inDirectory:@""];

Note that the extension is case-sensitive, this will only get files where the extension is "PNG", not "png".

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top