iPhone Dev: Swipe a UITableCell

前端 未结 1 781
误落风尘
误落风尘 2021-01-21 22:02

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 vie

1条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-21 22:58

    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?

    0 讨论(0)
提交回复
热议问题