2011-01-31 55 views
2

我有问题的tableview的编辑模式。当我们将表格设置为编辑模式时,它将右侧的行单元格缩进右侧的编辑字段。我想阻止这种事情发生。我已经设置了cell.shouldIndentWhileEditing = NO;但这并没有改变任何东西。UITableViewCell ShouldIndentWhen编辑问题

还有一点需要注意的是,这个单元格是通过编程的方式构建的,例如,

static NSString *CellIdentifier = @"ListingCustomCell"; 

    UITableViewCell *cell = (UITableViewCell *) [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 

    if (cell == nil) { 

     cell = [[UITableViewCell alloc]initWithFrame:CGRectMake(0, 0, tableView.frame.size.width, 34) reuseIdentifier:CellIdentifier]; 

    } 
    cell.shouldIndentWhileEditing = NO; 

//SETUP CELL FIELDS 

//return cell; 

关于什么我做错了任何想法?

感谢

回答

0

也许你的UITableViewDelegate在- (BOOL)tableView:(UITableView *)tableView shouldIndentWhileEditingRowAtIndexPath:(NSIndexPath *)indexPath返回YES。如果实现委托方法,它将覆盖单元格上的值。

+0

该方法未实现。我实现了它,并返回NO,但它仍然没有区别? – IPadHackAndSlash 2011-01-31 23:17:19

0

您是否阅读过这部分文档?

该属性仅影响在组合的 样式()中创建的表视图;它对 UITableViewStylePlain表格视图没有影响。

也许这就是你的情况。