【发布时间】:2017-12-23 14:56:01
【问题描述】:
我在同一个 UIViewController 上有 2 个 UITableView(表 1 和表 2)。我想在我的 Table-2 中编辑功能。
我在视图控制器中添加了 tableview 数据源方法,如下所述:-
func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) {
if editingStyle == .delete {
tableView.beginUpdates()
myArray.remove(at: indexPath.row)
tableView.deleteRows(at: [indexPath], with: .fade)
tableView.endUpdates()
}
}
和两个tableview都调用这个方法。所以每个tableview单元格都可以打开删除选项。
但我只希望在表 2 中使用此删除编辑选项。我想限制表 1 中的删除编辑选项功能。
请帮忙。提前致谢。
【问题讨论】:
标签: uitableview swift4 editing