我们正在使用uitableview并允许用户删除uitableviewcells,但会出现一个奇怪的错误,其中会出现两个删除按钮。
有没有人见过这个或有任何想法如何解决这个问题?
感谢您的帮助和时间。
此致 景静涛
更新1
我在行的索引处的单元格的代码
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
//cell.textLabel.lineBreakMode = NSLineBreakByWordWrapping;
cell.textLabel.lineBreakMode = NSLineBreakByWordWrapping;
//cell.detailTextLabel.lineBreakMode = NSLineBreakByWordWrapping;
cell.textLabel.lineBreakMode = NSLineBreakByWordWrapping;
cell.textLabel.numberOfLines = 0;
cell.detailTextLabel.numberOfLines = 0;
}
// Configure the cell...
[self configureCell:cell atIndexPath:indexPath];
return cell;
}
更新2
- (void)configureCell:(UITableViewCell *)cell atIndexPath:(NSIndexPath *)indexPath
{
//Sections logic
Model *info;
switch ([indexPath section])
{
case 0:
info = [self.bapiArray objectAtIndex:[indexPath row]];
break;
case 1:
info = [self.tablesArray objectAtIndex:[indexPath row]];
break;
case 2:
info = [self.tcodesArray objectAtIndex:[indexPath row]];
break;
default:
break;
}
cell.textLabel.text = info.subsection;
cell.detailTextLabel.text = info.text;
if(!(info.program == (id)[NSNull null] || info.program.length == 0))
{
cell.detailTextLabel.text = [NSString stringWithFormat:@"%@ Program:%@", info.text,info.program];
}
}