Reusable cell old image showing

后端 未结 6 834
醉话见心
醉话见心 2021-01-12 07:30

I am facing a problem when scrolling from top to bottom of my tableview. The reusable cell shows old image until new image download is completed.

It sh

6条回答
  •  我在风中等你
    2021-01-12 08:25

    Since it is a reusable cell, it indeed "reuses" the cell with the old image. Then you need to update it every time the cell is shown in cellForRowAtIndexPath:

     func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
            cell.image=placeholder_image
            //then download image
    }
    

提交回复
热议问题