I am using tableview accessory.Type (checkmark) in Tableview(didSelectRowAt:). When user click the row without checkmark, the checkmark will appear. When click the row with checkmark, the checkmark will disappear. Below is the code:
if cell?.accessoryType == .checkmark {
cell?.accessoryType = .none
} else {
cell?.accessoryType = .checkmark
}
The above code is working as expected. When change to the following, it doesn’t work. Any idea?
if cell?.accessoryType == .none {
cell?.accessoryType = .checkmark
} else {
cell?.accessoryType = .none
}
Aucun commentaire:
Enregistrer un commentaire