Chris
Chris

Reputation: 1650

Can I programmatically list files in Images.xcassets/Something?

Is it possible to list all images inside Images.xcassets/Something so that I can display them in a table list view?

I've tried:

NSArray *pngs = [NSBundle pathsForResourcesOfType:@".png" inDirectory:@"Images.xcassets/Something"];
NSInteger count = [pngs count];
NSLog(@"%d", count);

... but with little success.

Thanks

Upvotes: 4

Views: 3849

Answers (1)

Wain
Wain

Reputation: 119031

Don't try looking for the image files yourself - consider them to be private information in the app bundle. Instead, load them by name using imageNamed (no need to use the @2x or file extension).

Upvotes: 3

Related Questions