Im trying to figure out this code based on others answers.
You will need to add a Bool variable to your object and set it to true or false.
contact.addToGroup = false
Swift 3 example:
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if let cell = tableView.cellForRow(at: indexPath) {
let contact = contacts[indexPath.row]
if (cell.accessoryType == .checkmark) {
cell.accessoryType = .none
contact.addToGroup = false
} else {
cell.accessoryType = .checkmark
contact.addToGroup = true
}
}
tableView.deselectRow(at: indexPath, animated: true)
}
How do i make the contact.addToGroup = false
Aucun commentaire:
Enregistrer un commentaire