2014-06-28 68 views

回答

2

當然可以。這裏是UICollectionView Programming Guide

  1. 創建文件名
  2. 連接數據源的陣列,以UICollectionView
  3. 在使用圖像+imageNamed:方法與collectionView:cellForRowAtIndexPath:返回小區。

記得用UIImageView在裏面創建自定義單元格,創建outlet。

這裏是Tutorial哪些應該可以幫到你。

0
// fetch all the files from the documents directory. 
    NSArray *path = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); 
    library = [path objectAtIndex:0]; 
    fileArray = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:library error:nil]; 

    NSArray *imagelist = [[NSArray alloc] init]; 

    // filter the images from all the files. 
    for(int i = 0;i<fileArray.count;i++) 
    { 
     id object = [fileArray objectAtIndex:i]; 
     if ([object rangeOfString:@".png"].location !=NSNotFound) 
    { 
     [imagelist addObject:object]; 

    } 
    } 

然後創建以下UICollectionView數據源在集合視圖中添加項目集合查看和使用的情況下,

  • (UICollectionViewCell *)的CollectionView:(UICollectionView *)的CollectionView cellForItemAtIndexPath:(NSIndexPath * )indexPath;
相關問題