Reusing cell doesn't work well - TableView

前端 未结 6 1868
余生分开走
余生分开走 2021-01-27 12:35

I have a problem about my cell\'s button. In my tableView each row is composed by: an image, some labels and a button. The button has a checkmark image. When it is clicked, the

6条回答
  •  一生所求
    2021-01-27 13:12

    Try to do it like this:

    var checkBook = UIImageView()
    
    if self.checkBook.image == UIImage(named: "check"){
       self.checkBook.image = UIImage(named: "uncheck")
    }
    else{
       self.checkBook.image = UIImage(named: "check")
    }
    

提交回复
热议问题