NSMutableArray *assets = [[NSMutableArray alloc]init];ALAssetsLibrary *library = [[ALAssetsLibrary alloc]init];[library enumerateGroupsWithTypes:ALAssetsGroupSavedPhotos usingBlock:^(ALAssetsGroup *group,BOol *stop){ if(group != NulL){ [group enumerateAssetsUsingBlock:^(ALAsset *result,NSUInteger index,BOol *stop){ if(result != NulL){ [assets addobject:result]; }else NSLog(@"NO photo");; }]; }}failureBlock:^(NSError *error){NSLog(@"Error");}];
表视图的数据源方法:
- (UItableVIEwCell *)tableVIEw:(UItableVIEw *)tableVIEw cellForRowAtIndexPath:(NSIndexPath *)indexPath{Nsstring *IDentifIEr = @"ID";UItableVIEwCell *cell = (UItableVIEwCell*)[tableVIEw dequeueReusableCellWithIDentifIEr:IDentifIEr]; if(cell == NulL){ cell = [[UItableVIEwCell alloc]initWithStyle:UItableVIEwCellStyleDefault reuseIDentifIEr:IDentifIEr];}[cell.imageVIEw setimage:[UIImage imageWithCGImage:[[assets objectAtIndex:indexPath.row]thumbnail]]];[cell textLabel].text = @"Photo";return cell;
}
请求帮助我做错了….
感谢帮助
解决方法 您可以参考以下链接来解决您的问题http://agilewarrior.wordpress.com/tag/alassetslibrary/
总结以上是内存溢出为你收集整理的从iphone照片库中获取照片并在表格视图中显示全部内容,希望文章能够帮你解决从iphone照片库中获取照片并在表格视图中显示所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)