Reputation: 859
Some rows in my UITableView needs to delete and move in edit mode, but some just move. In this method I can enable or disable editing for some rows
override func tableView(tableView: UITableView, canEditRowAtIndexPath indexPath: NSIndexPath) -> Bool{
return true
}
But how to disable delete for some rows with enabled move?
Upvotes: 4
Views: 1752
Reputation: 5990
Return .None
for editingStyleForRowAtIndexPath
:
func tableView(tableView: UITableView, editingStyleForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCellEditingStyle {
return .None
}
A more complete answer that displays how to remove indentions is here -> Is there any way to hide "-" (Delete) button while editing UITableView
Upvotes: 5