tabviewcell 左滑 自定义按钮

    xiaoxiao2025-11-02  2

    -(NSArray<UITableViewRowAction *>*)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath{

        UITableViewRowAction * rowAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@"删除" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {

            MultiUserDataModel * model = dataArray[indexPath.row];

            [self RErequesteDeleteURL:model];

            if (isDeleteSuc) {

                [dataArray removeObjectAtIndex:[indexPath row]];

                [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObjects:indexPath, nil] withRowAnimation:UITableViewRowAnimationFade];

            }

            NSLog(@"删除");

        }];

        UITableViewRowAction * rowActionChange = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@"修改" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {

            NSLog(@"修改");

        }];

        rowAction.backgroundColor =[UIColor redColor];

        rowActionChange.backgroundColor = [ChangeColor hexStringToColor:@"D2D2D2"];

        NSArray * arr = @[rowAction,rowActionChange];

        return arr;

    }

    转载请注明原文地址: https://ju.6miu.com/read-1303787.html
    最新回复(0)