简体   繁体   English

滚动时带有ALAssets图像的UITableView单元格重叠

[英]UITableView cells with ALAssets images overlap when scrolled

In my ios project I'm using a uicollectionview and custom CollectionViewCells to load local images saved on the device (through ALAssets). 在我的ios项目中,我使用uicollectionview和自定义CollectionViewCells加载(通过ALAssets)保存在设备上的本地图像。

My problem occurs when the user scrolls down and then back up. 当用户向下滚动然后向上备份时,会发生我的问题。 It seems as though it takes long enough for ALAssets to load the image (I'm not using the thumbnail version) which gets it confused and sets the cell's wrong image. 看起来,ALAsets加载图像所需的时间似乎足够长(我没有使用缩略图版本),这使它感到困惑并设置了单元格的错误图像。 I know for sure that it's the wrong cell's image, as it has already been set in the past with the correct image. 我肯定知道这是错误的单元格图像,因为过去已经使用正确的图像设置了它。

How can I overcome this issue and synchronize the image loaded? 如何解决此问题并同步加载的图像?

Cancel ALAssets operations connected to each cell inside this function: 取消连接到此函数内部每个单元的ALAsets操作:

- (void)prepareForReuse

in your custom cells class. 在您的自定义单元格类中。 That should prevent updating image on cell which were reused and which has different content. 那应该防止更新重复使用且内容不同的单元格上的图像。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM