小编Wil*_*lls的帖子

更改单元格删除按钮的文本

我正在尝试更改单元格的删除按钮。我有两个功能:

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 ......提前致谢

uitableview ios swift

2
推荐指数
1
解决办法
1672
查看次数

标签 统计

ios ×1

swift ×1

uitableview ×1