我在「/ 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