I have a UITableView and I want to be able to reorder the rows when I'm not in edit mode, meaning I don't want to see the delete icons until I press Edit. I want to be able to see and use the reordering controls all the time. Is that possible?
Do I have to keep the UITableView in editing mode all the time and enable/disable the delete icon manually? How to disable the swipe to delete in that case?
As far as I'm aware you can't do it using just the editing flag. However, it's not hard to achieve a similar effect.
Have your own boolean ie deleting
. Set the tableview cell to cell.showsReorderControl = YES
.
Then implement all the methods required for moving cells. The bit of code I think you're looking for is.
– tableView:editingStyleForRowAtIndexPath:
if deleting == YES
return UITableViewCellEditingStyleDelete
otherwise return UITableViewCellEditingStyleNone
.
Finally, set tableView.editing = YES
always. If before and after changing the deleting
bool you run [tableView beginUpdates]
and [tableView endUpdates]
everything should work fine. Let me know if this doesn't make sense, and I'll try again.