objective-cxcodepngimage-uploadingimagenamed

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!


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