我在“/ Documents/saved /”目录下有几个图像为png格式。 我装这个目录到所谓的“内容” 当我使用的NSLog查看此数组的内容,我看到的图像,以及一个.DS_STORE文件数组 我想要做的是加载所有这些图像插入UICollectionView细胞。将文档子目录中的图像加载到UICollectionViewCell中
我想这一点,
[[cell collectionImageView] setImage:
[UIImage imageWithContentsOfFile:
[contents objectAtIndex:indexPath.item]]];
的collectionImageView连接到的UIImageView在UICollectionViewCell
但它似乎并不work.EDIT
NSString *dataPath = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/DImage"];
NSArray *contents = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:dataPath error:NULL];
的NSLog(@” %@“,内容);
这给了我输出
2013-03-25 10:37:20.186 aUX[543:c07] (
".DS_Store",
"savedImage_0.png",
"savedImage_1.png",
"savedImage_2.png",
"savedImage_3.png",
"savedImage_4.png",
"savedImage_5.png"
)
(我已经拖了一个名为collectionImageView的UIImageView) 我需要显示这些图像逐一集合视图细胞。
多一点的代码会有帮助。 “内容”数组中有什么? – gaige 2013-03-24 20:05:36
*什么*不起作用? – Mundi 2013-03-24 20:37:08