如题,我在UITableView的dataSource中返回Cell的代码如下:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
LLDCommentCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellIDMyComments forIndexPath:indexPath];
[cell.imageView sd_setImageWithURL:url];
return cell;
}
有一个问题是,当快速滑动界面时,可能这个cell只是一闪而过,而此代码却仍然要加载这些图片。我希望能够在tableView停止滚动时,优先加载当前显示的cell的图片。请问怎么做比较合适
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
在[cell.imageView sd_setImageWithURL:url]; 之前调用一下sd_cancelCurrentImageLoad
每次cell复用,就取消当前的image载入
也许可以在
scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate
里加载图片?这个我也没做过,抛砖引玉哈。