1--tableview cell 左划删除/重命名/修改/置顶
-(NSArray<UITableViewRowAction *> *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath{
UITableViewRowAction *delectAct=[UITableViewRowActionrowActionWithStyle:UITableViewRowActionStyleDestructivetitle:@"删除"handler:^(UITableViewRowAction *_Nonnull action,NSIndexPath * _Nonnull indexPath) {
// [tableView beginUpdates];
[self deleteTemplateAtRow:indexPath.row];
[arraylist removeObjectAtIndex:indexPath.row];
// [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationAutomatic];
[tableView reloadData];
// [tableView endUpdates];
}];
return @[delectAct];
}
先删除数据源中那一行的数据 --再在 tableview 中删除改行
例中 数据存在数据库中 先删除数据库中一条---删除存放数据的 arrlist--- 删除 tableviewcell 一行
本来该是
[tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationAutomatic]
出错,之后用刷新整个表单 ok== 不过这样麻烦浪费资源-_-