3

I have an UITableView with multiple UITableViewCells. I implemented the following delegate methods to allow the user the "swipe-to-delete" functionallity.

UITableView -> canEditRowAtIndexPath
UITableView -> commitEditingStyle

It basically looks like this now: current status

But now i want to trigger the "swipe-gesture" manually from my code. I tryed to implement UITableView -> didSelectRowAtIndexPath and in there i was using cell.setEditing (true, animated: true). But it does not work. Any ideas on how i can do that?

Here is my current code:

var cell = tableView.cellForRowAtIndexPath (indexPath) as! UITableViewCell
cell.setEditing (true, animated: true)

Thanks!

Leo
  • 91
  • 6

0 Answers0