I am creating something similar to alarm app. Like alarm app on selected days. Is there any method or delegate function of the table to help me disable all other cells if every day is selected. And if every day is selected all other days are already selected and the only way to change it by unticking every day.
Please help if there is some easy way or lib. Otherwise, I guess it gonna take a long time and will need to reload table every time user select every day to make changes.
My code so far
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at: indexPath, animated: true)
if let cell = tableView.cellForRow(at: indexPath) {
if cell.accessoryType == .checkmark {
cell.accessoryType = .none
if indexPath.row == 0 {
cell.isUserInteractionEnabled = true
}
removeDays(n: UInt8(indexPath.row))
} else{
cell.accessoryType = .checkmark
if indexPath.row == 0 {
cell.isUserInteractionEnabled = false
}
addDays(n: UInt8(indexPath.row))
}
}
}