0
在我的tableView中,我希望單元格是不可選的。
所以我在TableViewController寫道:Swift UITableView willSelectRowAt無法正常工作
override func tableView(_ tableView: UITableView, willSelectRowAt indexPath: IndexPath) -> IndexPath? {
if indexPath.section == 0 {
return nil
} else {
if switchIsOn! {
return indexPath
} else {
return nil
}
}
}
它的工作原理,當我使細胞正常的觸摸預期,但是當我認爲我的手指向下的細胞,它變得無論如何選擇。我怎樣才能避免這種情況?
? –
兩者。但對不起,我問我的問題不好,我會在一瞬間編輯它 –
所以我添加到我的代碼示例,我不希望所有單元格不可選擇 –