UITableView Checkmarks disappear when scrolling

前端 未结 5 1703
一整个雨季
一整个雨季 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:48

    func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) ->    UITableViewCell{
    var cell : UITableViewCell = .........
    if(boolArray[indexPath.row){
        cell.accessoryType = UITableViewCellAccessoryType.Checkmark
    } else {
        cell.accessoryType = UITableViewCellAccessoryType.None
    }
    }
    

    Try this code.

提交回复
热议问题