Oscar
Oscar

Reputation: 1035

iPhone Dev: Swipe a UITableCell

How does one program the ability to swipe a UITableCell. I already have a subclass that I've been working with of UITableCell. Do I just handle swipes in it, like I would a view?

Upvotes: 2

Views: 677

Answers (1)

theChrisKent
theChrisKent

Reputation: 15099

You will need to implement this method:

tableView:editingStyleForRowAtIndexPath:

and return UITableViewCellEditingStyleDelete

To make it work you'll also want to implement these methods:

tableView:commitEditingStyle:forRowAtIndexPath:
tableView:canEditRowAtIndexPath:

To customize the text of the delete button see this thread: UITableView Swipe to delete: how to customize button and action?

Upvotes: 1

Related Questions