2014-06-28 64 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;
相关问题