我正在尝试更改单元格的删除按钮。我有两个功能:
override func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -> [UITableViewRowAction]? {
let titleBtn = UITableViewRowAction(style: UITableViewRowActionStyle.default, title: "Supprimer") { (action , indexPath ) -> Void in
self.isEditing = false
//ackAction.backgroundColor = UIColor.orange
}
return [titleBtn]
}
override func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
return true
}
Run Code Online (Sandbox Code Playgroud)
但是,当我运行我的应用程序时,按钮的文本已更改,但删除不起作用(我无法从数组和 tableview 的行中删除数据)。在添加此功能之前,一切都完美无缺。一个细节:在canEditRowAt函数中,我也试图返回 false ......提前致谢