美文网首页
iOS 多选cell,限制个数

iOS 多选cell,限制个数

作者: 吴佩在天涯 | 来源:发表于2017-08-15 11:23 被阅读66次
  • (NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath {

    self.selectedArr = [tableView indexPathsForSelectedRows];

    if (self.selectedArr.count >= 5) {//只能选择5个

      [self showAlert];//提示用户
    
      return nil;//返回nil,就会不会触发 didselect ..方法
    

    }

    return indexPath;
    }

参考[https://stackoverflow.com/questions/24381005/how-to-limit-the-multi-selection-in-uitableviewcontroller]

相关文章

网友评论

      本文标题:iOS 多选cell,限制个数

      本文链接:https://www.haomeiwen.com/subject/dfpmrxtx.html