SDWebImage + UITableViewCell, wrong image when scrolling?

前端 未结 5 1896
失恋的感觉
失恋的感觉 2021-02-06 04:08

i\'m having an issue using SDWebImage to load images to a UIImageView inside a custom UITableViewCell. This is my code at the UITableView delegate:

    static NS         


        
5条回答
  •  南方客
    南方客 (楼主)
    2021-02-06 04:45

    If you have your UITableViewDelegate set on your table, you could use the delegate method:

    - tableView:didEndDisplayingCell:forRowAtIndexPath:

    to set the image to NULL (or the default) when your cell scrolls off screen.

    And since you're using SDWebImage, canceling it could be as easy as "cancelCurrentImageLoad" on the cell's image view.

提交回复
热议问题