【发布时间】:2021-10-31 00:28:42
【问题描述】:
对于 UITableViews,我添加了三个不同的单元格
如何为特定单元格启用删除选项
func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) {
switch dataSource[indexpath.section].menu {
case "Attachment":
if editingStyle == AttachmentTableViewCell.EditingStyle.delete {
attachmentList.remove(at: indexPath.row)
tableView.deleteRows(at: [indexPath], with: UITableView.RowAnimation.automatic)
}
break
default:
break
}
}
在这种情况下,它也会显示其他单元格的删除选项。 如何在滑动到其他 UITableViewCell 时停止显示删除选项。
【问题讨论】:
标签: ios swift uitableview