您的位置:首页 > 其它

tableview cell 左划删除/重命名/修改/置顶

2016-04-01 11:34 204 查看
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== 不过这样麻烦浪费资源-_-
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: