kiri
kiri

Reputation: 2007

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

Upvotes: 8

Views: 1883

Answers (1)

Brock Woolf
Brock Woolf

Reputation: 47322

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.

Upvotes: 6

Related Questions