nsmutalbe select

- (void) setEditing:(BOOL)editting animated:(BOOL)animated

{

    [self.tableViewsetEditing:editting animated:YES];

    [self.tableViewsetMultipleTouchEnabled:YES];

   // [self.tableView setEditing:editting animated:YES];

}


viewdidload()

  self.tableView.allowsSelectionDuringEditing = YES;

    self.tableView.allowsMultipleSelection = YES;

    self.tableView.allowsMultipleSelectionDuringEditing = YES;



//select all row

-(IBAction)selectAll:(id)sender

{


    UIButton *btn = (UIButton *)sender;

    if (btn.tag == 0) {

        for (int i =0; i<5; i++) {

            NSIndexPath *myindexPath = [NSIndexPathindexPathForRow:i inSection:0];

            [self.tableViewselectRowAtIndexPath:myindexPath animated:YESscrollPosition:UITableViewScrollPositionNone];

        }

        btn.tag = 1;

    }else{

        for (int i =0; i<5; i++) {

            NSIndexPath *myindexPath = [NSIndexPathindexPathForRow:i inSection:0];

            [self.tableViewdeselectRowAtIndexPath:myindexPath animated:YES];

            

        }

        btn.tag = 0;

        

    }


  

}


原文地址:https://www.cnblogs.com/guligei/p/9029246.html