[self.tableView setEditing:YES animated:NO];
2.设置编辑样式为多选(两个属性加起来就是这么神奇)
-(UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath*)indexPath
{
return UITableViewCellEditingStyleDelete|UITableViewCellEditingStyleInsert;
}
0 处理全选 //实现点击全选按钮,实现全部选中,再点击删除,删除所有选中的cell
//暂时没做反选
//全选按钮点击事件
-(void)allChoiceBtnClick:(UIButton *)btn
{
btn.selected = ! btn.selected;
if (btn.selected) {
//将可见的设为全选状态
for (NSIndexPath *cellIndex in [self.tableView indexPathsForVisibleRows])
{
KeChooseManagerCell * otherCell = (KeChooseManagerCell *)[self.tableViewcellForRowAtIndexPath:cellIndex];
otherCell.selected = YES;
self.isAllSelected = YES;
self.indexArr = [NSMutableArray new];
//遍历数组创建含有section和row的NSIndexPath,然后将它传给tableview,用来删除全部选中的cell
for (int i = 0; i < self.stockList.count; i++) {
NSIndexPath * realIndex = [NSIndexPath indexPathForRow:i inSection:0];