【发布时间】:2023-03-21 00:10:01
【问题描述】:
if (cell.tag == indexPath.row) {
[cell.imageView sd_setImageWithURL:[NSURL URLWithString:[enclosureUrlArray objectAtIndex:indexPath.row]]
placeholderImage:[UIImage imageNamed:@"placeholder"] options:indexPath.row == 0 ? SDWebImageRefreshCached : 0];
CGSize itemSize = CGSizeMake(50, 50);
UIGraphicsBeginImageContext(itemSize);
CGRect imageRect = CGRectMake(0.0, 0.0, itemSize.width, itemSize.height);
[cell.imageView.layer setMasksToBounds:YES];
[cell.imageView.layer setCornerRadius:2.5f];
[cell.imageView.image drawInRect:imageRect];
cell.imageView.image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
cell.imageView.autoresizingMask = UIViewAutoresizingNone;
}
return cell;
我只使用了 SDWebImage。当我滚动时,我的UITableView 单元格被卡住了 - 它滚动不顺畅。我正在从 Web 服务中检索图像。你能告诉我为什么会这样吗?
【问题讨论】:
-
请更好地描述您的问题/问题。
-
实际上,当我滚动它卡住的 tabelview 单元格时,它并不顺利。这是我的问题。我使用的上述代码。我从网络服务获取图像。
-
图片在哪里?看起来您在单元格方法中做了很多工作,这就是它看起来滞后的原因。
-
刚才我提到了图片大小是对的
-
我认为如果 (cell.tag == indexPath.row) 尝试删除它,则无需设置条件。其实没用
标签: ios objective-c uitableview uiimage sdwebimage