If you want to do this, you will need to use the NSFileManager to view the contents of [[NSBundle mainBundle] bundlePath] (the path of your application package) to find all files with the correct extension.
The best question is: why do you want to do this?
Edit: in order, if you insist, you will need to do something like this:
NSEnumerator *iter = [[NSFileManager defaultManager] directoryEnumeratorAtPath:[[NSBundle mainBundle] bundlePath]]; int count = 0; // number of images for (NSString *path in iter) { // iterate through all files in the bundle if ([[path pathExtension] isEqualToString:@"png"]) { // test if the extension is "png" count++; // increment the number of images UIImage *img = [UIImage imageWithContentsOfFile:path]; // do other things with the image } }
source share