加快从ALAssetsLibrary中读取并填充UITableView的可能方法 [英] Possible ways to speed up reading from ALAssetsLibrary and populating a UITableView

查看:92
本文介绍了加快从ALAssetsLibrary中读取并填充UITableView的可能方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在,我正在使用ALAssetsLibrary从ALAssetsGroupSavedPhotos和ALAssetsGroupLibrary中收集照片。将所有资产读入数组后,我填充了UITableView([myTable reloadData])以显示照片。

Right now, I am using the ALAssetsLibrary to gather the photos from ALAssetsGroupSavedPhotos and ALAssetsGroupLibrary. Upon reading all the assets into an array, I populate my UITableView ([myTable reloadData]) to show the photos.

我发现,如果用户有很多照片,是越来越多的延迟。有什么办法可以加快速度吗?尽管Camera Roll或PhotoLibrary中的照片数量很多,默认的UIIMagePicker似乎完全没有延迟。有什么方法可以达到同样的速度?

I find that if the user has many photos, there is an increasing amount of delay. Is there any way to possible speed things up? The default UIIMagePicker seems to have no delay at all, despite the number of photos in the Camera Roll or PhotoLibrary. Is there any way to attain the same speed?

谢谢!

推荐答案

只需使用资产组的 enumerateAssetsAtIndexes:(NSIndexSet *)indexSet选项:(NSEnumerationOptions)选项使用枚举来枚举当前需要显示的资产:(ALAssetsGroupEnumerationResultsBlock)而不是使用-(void)enumerateAssetsUsingBlock:(ALAssetsGroupEnumerationResultsBlock)enumerationBlock

您可以(我想您想填充表格视图),例如,只需枚举 tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)中索引 indexPath.row 处的资产)indexPath 方法。

you could (i suppose you want to fill a table view) for example just enumerate the asset at the index indexPath.row in your tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath method.

这篇关于加快从ALAssetsLibrary中读取并填充UITableView的可能方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆