これを行う:
NSString *bundleRootpath = [[NSBundle mainBundle] bundlePath];
NSString *filePath = [bundleRootpath pathForResource:@"bags_1" ofType:@"png" inDirectory:@"Images/bagold"]
NSFileManager *fileMangr = [NSFileManager defaultManager];
NSArray *dirContents = [fileMangr contentsOfDirectoryAtPath:bundleRootpath error:nil]; //your path here it may be document directory also
JPGがある場合はフィルタリング
NSArray *onlyJPGs;
if([dirContents count] > 0){
NSPredicate *fltrJPG = [NSPredicate predicateWithFormat:@"self ENDSWITH '.jpg'"];
onlyJPGs = [dirContents filteredArrayUsingPredicate:fltrJPG];
}
今ならPNG
NSArray *onlyPNGs;
if([dirContents count] > 0){
NSPredicate *fltrPNG = [NSPredicate predicateWithFormat:@"self ENDSWITH '.png'"];
onlyPNGs = [dirContents filteredArrayUsingPredicate:fltrPNG];
他の形式がある場合は検索します
onlyJPGsとonlyPNGsを1つの配列にマージします