【发布时间】:2021-04-30 05:21:24
【问题描述】:
I've implemented checkmarks (when row is selected) with the following code in cellForRowAt:
// Add a checkmark to row when selected
if selectedIngredients.contains(indexPath.row) {
cell.accessoryType = .checkmark
} else {
cell.accessoryType = .none
}
但是,当我选择一行时,each 部分中的 index.row 会获得复选标记:
这似乎是因为我只指定了 indexPath.row,而不是节。我该如何编写代码以便仅在我选择的部分中选择的行获得复选标记?
【问题讨论】:
-
请添加更多代码
标签: ios swift uitableview tableview accessorytype