我想通过一次滑动手势删除单元格。问题是,当我向左滑动时,将显示删除图标。当然,当我单击删除图标时,单元格将被删除。我想在滑动手势后立即删除单元格。它受ios 9支持吗?
更多详细信息
当用户向左滑动到单元格的中间时,将显示删除按钮。当他继续滑动到屏幕边缘时,该单元格将被删除。
最佳答案
为什么没有自定义表格单元
在单元格上,在内容视图或任何部分上添加滑动手势,
使用indexpath将其调用委托给tableviewcontroller
- (void)someDelegateFunctionToDeleteCellAtIndexPath:(NSIndexpath *)indexPath{
[dataSourceArray removeObjectAtIndex:indexPath.row];
NSArray *deleteIndexPaths = @[indexPath];
[tableView beginUpdates];
[tableView deleteRowsAtIndexPaths:deleteIndexPaths withRowAnimation:UITableViewRowAnimationFade];
[tableView endUpdates];
}