![](/img/trans.png)
[英]The method selectRow(at:animated:scrollPosition:) doesn't call tableView(_:didSelectRowAt:)
[英]what is the different between isSelected method of tableviewcell and selectRow(at:animated:scrollPosition:) of tableview
当我想设置要选择的单元格时,tableviewcell 的isSelected
方法和 tableview 的selectRow(at:animated:scrollPosition:)
有什么不同?
即cell.isSelected = true
vs tableview.selectRow(at:index, animated: false, scrollPosition: .none)
我发现大多数人使用后者,但我不知道为什么
一个单元格上的工作:意味着你有指向它的指针(主要是在 didSelectRow 中完成,例如在推送详细视图后取消选择该行)。 另一个告诉表格视图 select 单元格不必引用它。
选择行(在:动画:滚动位置:)
选择由索引路径标识的表视图中的一行,可选择将该行滚动到表视图中的某个位置。
细胞.isSelected
isSelected
bool 影响单元格的外观。 默认值为 false。
欲了解更多信息:
https://developer.apple.com/documentation/uikit/uitableviewcell/1623263-isselected https://developer.apple.com/documentation/uikit/uitableview/1614875-selectrow
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.