My image assets catalog has a folder named \"Nature\" with hundreds of image files inside.
I would like to get an array of image file names under the \"Nature\" dire
I know there are 2 ways to get an array of image files.
In assets use the same prefix for all your images and append an incrementing number:
then you can:
for (int i = 1; i <= 6; i++) {
UIImage *image = [UIImage imageNamed:[NSString stringWithFormat:@"bg_button%d", i]];
NSLog(@"%@", image);
}
Create folder references rather than image assets
So we can get an array of image files using this snippet:
NSString *directory = [NSString stringWithFormat:@"Intro"];
NSArray *intros = [[NSBundle mainBundle] pathsForResourcesOfType:@"png" inDirectory:directory];
NSLog(@"%@", intros);
Hope this did help you!