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.
Programmatically swipe UITableViewCell?
Asked Answered
Were you able to figure out how to do this ? –
Seamstress
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.
© 2022 - 2024 — McMap. All rights reserved.