这是我的代码
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
tableView.deselectRowAtIndexPath(indexPath, animated: true)
let key = sortedKeys[indexPath.row]
if (selectedTypes!).contains(key) {
selectedTypes = selectedTypes.filter({$0 != key})
} else {
selectedTypes.append(key)
}
tableView.reloadData()
}
我正在取消选择第二行的单元格,但它不起作用
最佳答案
SDK 不会在您的应用启动时自动选择所有单元格。
如果所有 tableView 单元格都被选中,这是因为您的代码(或第三方控件或库)中的某些内容而发生的。
此外,当以编程方式选择一行时,didSelectRowAtIndexPath
不会被调用。它仅在用户选择一行时调用,因此您希望可行的方法不会自动取消选择任何选定的行。
关于ios - 如何在应用程序快速启动时取消选择 uitableview 单元格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34469261/