有没有办法以编程方式触发在具有编辑操作的 UITableViewCell 上向左滑动的等价物?这与简单的 [tableView setEditing:YES animated:YES]
不同,因为该方法将整个表格设置为编辑模式并显示插入/删除左侧附件 View 和/或重新排序控件而不是编辑操作单行。
最佳答案
你可以使用 optional func tableView(_ tableView: UITableView, editingStyleForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCellEditingStyle
from UITableViewDelegate .并为您要滑动的单元格返回 UITableViewCellEditingStyleDelete
。当你想触发滑动时,使用 func reloadRowsAtIndexPaths(_ indexPaths: [NSIndexPath], withRowAnimation animation: UITableViewRowAnimation)
重新加载该单元格。
关于ios - 以编程方式滑动 UITableViewCell?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36103077/