如何加载名称相似的所有图像
How to load all images with similar names
我的 xcasset 中有几张图片,所以我可以加载图片:
[UIImage imageNamed:@"face_icon_1"];
如果我的图片名称类似于 "face_icon_2"、"face_icon_3" 等,我如何在不使用硬编码的情况下找到它们?
UIImage *image;
NSInteger counter = 1;
do {
image = [UIImage imageNamed:[NSString stringWithFormat:@"face_icon_%zd", counter++];
//add the image to an array
} while (image);
我的 xcasset 中有几张图片,所以我可以加载图片:
[UIImage imageNamed:@"face_icon_1"];
如果我的图片名称类似于 "face_icon_2"、"face_icon_3" 等,我如何在不使用硬编码的情况下找到它们?
UIImage *image;
NSInteger counter = 1;
do {
image = [UIImage imageNamed:[NSString stringWithFormat:@"face_icon_%zd", counter++];
//add the image to an array
} while (image);