Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get List of Images Using NSBundle

I am having List of images in my project i have to get the entire list Using NSBundle, How can i do this

Thank You

like image 834
kiri Avatar asked Aug 12 '10 04:08

kiri


1 Answers

This should do it:

 NSLog(@"Images in bundle are:");

 NSString *imageExtension = @"png";
 NSArray *pngPaths = [[NSBundle mainBundle] pathsForResourcesOfType:imageExtension inDirectory:nil];
 for (NSString *filePath in pngPaths)
 {
     NSString *fileName = [filePath lastPathComponent];
     NSLog(@"%@", fileName);
 }

Just change the imageExtension string for the image type you want.

like image 101
Brock Woolf Avatar answered Nov 03 '22 05:11

Brock Woolf