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;

        

    }

  • 相关阅读:
    ES6 解构
    flutter
    selenium
    selenium
    python
    selenium
    selenium
    selenium
    selenium
    selenium- SMTP发送邮件
  • 原文地址:https://www.cnblogs.com/chaoyueME/p/5937723.html
Copyright © 2011-2022 走看看