Derek Thurn
Derek Thurn

Reputation: 15355

Hide UITableView's delete confirmation button after click

In my UITableView, I have custom behavior for the delete button that does not involve deleting the row itself (specifically, it moves the row to a different section). However, after performing my custom action, the row is still visible, so the big red [Delete] confirmation button is still visible. Is there a way to programmatically hide the delete confirmation button and return to the regular editing state?

I am aware that I can turn off editing altogether via setEditing:animated:. What I'm looking for is a way to revert the row back to its normal editing state, as if the user had clicked the red (-) button and then changed their mind about deleting it.

Upvotes: 1

Views: 1065

Answers (2)

Arnaud
Arnaud

Reputation: 17737

Swift + an animation choice that feels more natural given the position of the delete button:

tableView.reloadRowsAtIndexPaths([indexPath], withRowAnimation: .Right)

Upvotes: 0

John McKnight
John McKnight

Reputation: 684

Try this

[tableView reloadRowsAtIndexPaths:[NSArray arrayWithObject:indexPath]
                 withRowAnimation:UITableViewRowAnimationNone];

Upvotes: 4

Related Questions