0
我提出的扩大tableViewCell和我的变量而言假的默认值。如果该值为假然后细胞收缩,当其真正然后细胞扩大。问题是,当一个细胞的值真我希望所有其他细胞值为假,我很努力。这里是我下面的代码:取消选择的行取决于值时的UITableView选择其他行夫特
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let content = datasource[indexPath.row]
//Here content.expand = false by default in other class
if indexPath.row == 0 {
print("0 row")
content.expanded = !content.expanded
} else if indexPath.row == 1 {
print("1 row")
content.expanded = !content.expanded
} else if indexPath.row == 2 {
print("2 row")
content.expanded = !content.expanded
}
tableView.reloadRows(at: [indexPath], with: .automatic)
}
我不想要两个细胞在同一时间进行扩展。请帮忙。