我需要訪問我的資源文件夾中的所有jpg,png,bmp,但 做下面只給我jpg ... 算法錯誤嗎? 還是有一個更短,更簡單的語法,讓我一次訪問所有三個? 請幫我..如何獲取使用路徑的多種類型的文件ForResourcesOfType
NSMutableArray *paths = [[[NSBundle mainBundle] pathsForResourcesOfType:@"jpg" inDirectory:nil] mutableCopy];
NSMutableArray *paths2 = [[[NSBundle mainBundle] pathsForResourcesOfType:@"png" inDirectory:nil] mutableCopy];
NSMutableArray *paths3 = [[[NSBundle mainBundle] pathsForResourcesOfType:@"bmp" inDirectory:nil] mutableCopy];
for(NSString *filename in paths)
{
filename = [filename lastPathComponent];
NSLog(@" filename is %@", filename);
[filenames addObject:filename];
NSLog(@" filenames array length is now %d", [filenames count]);
}
等了paths2和paths3 ...