📜  再次选择单元格时删除复选标记 swift 5 - Swift 代码示例

📅  最后修改于: 2022-03-11 15:01:03.644000             🧑  作者: Mango

代码示例1
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
        if let cell = tableView.cellForRow(at: indexPath as IndexPath) {
            if cell.accessoryType == .checkmark {
                cell.accessoryType = .none
            } else {
                cell.accessoryType = .checkmark
            }
        }
        tableView.deselectRow(at: indexPath, animated: true)
    }