我增加了许多图片到我的Xcode项目:图标,主背景,默认值(闪屏),占位符,等等。 我可以得到所有这些图像的名字到一个数组?
Answer 1:
这应该在你的应用程序文件夹中返回所有的PNG的数组。
[[NSBundle mainBundle] pathsForResourcesOfType:@"png" inDirectory:nil];
注*数组包含路径。 如果你只是想名称中使用- (NSString *)lastPathComponent
对阵列的具体指标,即
NSString *imgName = [[imgArray objectAtIndex:0]lastPathComponent]; //myImage.png
文章来源: Get file names of images that are included in project