Programmatically swipe UITableViewCell?
Asked Answered
S

1

9

Is there any way to programmatically trigger the equivalent of swiping left on a UITableViewCell that has edit actions? This is different from simply [tableView setEditing:YES animated:YES] as that method sets the entire table into editing mode and shows the insert/delete left accessory view and/or reorder controls rather than the edit actions for a single row.

See answered 19/3, 2016 at 14:42 Comment(1)
Were you able to figure out how to do this ?Seamstress
O
-2

You can use optional func tableView(_ tableView: UITableView, editingStyleForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCellEditingStyle from UITableViewDelegate. And return UITableViewCellEditingStyleDelete for the cell you want to swipe. Use func reloadRowsAtIndexPaths(_ indexPaths: [NSIndexPath], withRowAnimation animation: UITableViewRowAnimation) to reload that cell when you want to trigger the swipe.

Obeisance answered 19/3, 2016 at 15:13 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.