以编程方式刷UITableViewCell?

Ken*_*rty 8 uitableview ios uitableviewrowaction

有没有办法以编程方式触发相当于在具有编辑操作的UITableViewCell上向左滑动?这与简单的[tableView setEditing:YES animated:YES]方法不同,因为该方法将整个表设置为编辑模式并显示插入/删除左附件视图和/或重新排序控件而不是单行的编辑操作.

Jel*_*lly -2

您可以optional func tableView(_ tableView: UITableView, editingStyleForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCellEditingStyle使用UITableViewDelegate。然后返回UITableViewCellEditingStyleDelete您要滑动的单元格。func reloadRowsAtIndexPaths(_ indexPaths: [NSIndexPath], withRowAnimation animation: UITableViewRowAnimation)当您想要触发滑动时,用于重新加载该单元格。