zoukankan      html  css  js  c++  java
  • 设置删除某一行cell

    //点击的方法

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

        // 删除按钮

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

            [self.dataArray removeObjectAtIndex:indexPath.section - 1];

    ;

            [tableView deleteSections:[NSIndexSet indexSetWithIndex:indexPath.section] withRowAnimation:UITableViewRowAnimationNone];

            

        }];

        action1.backgroundColor = [UIColor redColor];

        

           return @[action1];

    }

    //设置某一行的可编辑与否

    - (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath

    {

        

        NSIndexPath * indexP =[NSIndexPath indexPathForRow:0 inSection:0];

        

        if (indexP == indexPath) {

            

            return NO;        

        }

        return YES;

        

    }

  • 相关阅读:
    Mysq数据库备份(win)
    Mysql保存中文乱码问题
    MySql常用操作
    win下 mysql远程连接设置
    windows下redis的使用
    栈和队列
    ffmpeg 常用命令
    nginx https配置模板
    openssl 、nginx生成配置自签名证书
    https、公钥,私钥,数字证书
  • 原文地址:https://www.cnblogs.com/chaoyueME/p/5937723.html
Copyright © 2011-2022 走看看