这是本人实习中遇到的问题
首先table.editing= YES;
- (UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *identifier = @"cell";
TableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];
if(cell == nil)
{
cell = [[[NSBundle mainBundle] loadNibNamed:@"TableViewCell" owner:self options:nil] lastObject];
// cell1.selectionStyle = UITableViewCellSelectionStyleNone; // 是让行选择后的效果不出现阴影。而判定多选的机制估计就是靠行选中阴影来判断的。所以当这句话生效会导致无法多选!
}
return cell;
}
- (UITableViewCellEditingStyle )tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath
{
return UITableViewCellEditingStyleDelete | UITableViewCellEditingStyleInsert;
}
最后实现的效果
不妥之处望大家拍砖