ObjectiveC-InLearning
ObjectiveC-InLearning

Reputation: 441

How can I get the list of PNG names that are in my supporting files?

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!

Upvotes: 0

Views: 236

Answers (1)

omz
omz

Reputation: 53551

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".

Upvotes: 2

Related Questions