UITableView Checkmarks disappear when scrolling

前端 未结 5 1715
一整个雨季
一整个雨季 2020-11-30 08:38

I have to make checkmarks on a tableView, but if I\'m scrolling and one check marked cell is not visible and I scroll back the checkmark disappeared.

While running

5条回答
  •  时光说笑
    2020-11-30 08:59

     func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) ->    UITableViewCell
    

    reuses cells as you can see from the code. You need to keep the state of your selected cells, and assign the accessory views state after var view = UITableViewCell ...

提交回复
热议问题