如何启用移动但禁用UITableView中某些行的删除

Wal*_*est 4 uitableview ios swift

我的UITableView中的某些行需要删除并在编辑模式下移动,但有些行只是移动.在这种方法中,我可以启用或禁用某些行的编辑

override func tableView(tableView: UITableView, canEditRowAtIndexPath indexPath: NSIndexPath) -> Bool{
            return true
    }
Run Code Online (Sandbox Code Playgroud)

但是如何在启用移动的情况下禁用某些行的删除?

kej*_*eji 5

返回.NoneeditingStyleForRowAtIndexPath:

func tableView(tableView: UITableView, editingStyleForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCellEditingStyle {
     return .None
}
Run Code Online (Sandbox Code Playgroud)

这里有一个更完整的答案,显示如何删除缩进 - > 编辑UITableView时有没有办法隐藏" - "(删除)按钮