【问题标题】:Images are overlapping in the UITableView how to fix this?图像在 UITableView 中重叠如何解决?
【发布时间】:2019-01-02 04:47:13
【问题描述】:

在 UITableviewcell 中,图像使用 SDWebImage 显示。 有时图像在 UITableview 中重叠/重复。

在 - cellForRowAtIndexPath 中使用以下代码:

[cell.imgView sd_setImageWithURL:url placeholderImage:ImagePlaceholder options:SDWebImageRefreshCached completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
   [cell.imgView setImage:image];
}];

【问题讨论】:

    标签: objective-c xcode uitableview uiimageview sdwebimage


    【解决方案1】:

    我相信问题出在您的表格视图单元格类中。 请发布您的代码。

    检查你的 cellClass 是否有方法 prepareForReuse。

    应该是这样的:

    override prepareForReuse() {
        someLabel.text = ""
        someImage.image = nil
    }
    

    【讨论】:

      【解决方案2】:

      通常这从未发生在我身上,但如果发生这种情况,请从 imageview 中删除内容,然后设置图像

      【讨论】:

        猜你喜欢
        • 2021-12-04
        • 1970-01-01
        • 1970-01-01
        • 2021-05-24
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多