我对这个问题有点疯狂。我有一个表格视图,我想在其中的所有单元格中显示表格视图单元格删除编辑控件,除了一节中的最后一个。但是,我正好相反,删除控制只显示在最后一行。谁能告诉我为什么?UITableViewCell编辑属性似乎是颠倒
在我的视图控制器的viewDidLoad方法我有:
- (void)viewDidLoad {
...
[self.tableView setEditing:YES animated:NO]
}
以我表视图数据源的cellForRowAtIndexPath:方法我有:
// All except for the last cell in the section are in editing mode
if ([indexPath row] == ([tableView numberOfRowsInSection:[indexPath section]] - 1)) {
[cell setEditing:NO animated:NO];
}
else {
[cell setEditing:YES animated:NO];
}
我还添加
- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath
{
return UITableViewCellEditingStyleDelete;
}
,如果我删除的UITableViewCell setEditing作品:动画:来电。但我需要能够显示并隐藏删除按钮,而无需实际重新加载表视图单元格,并且我想通过调用UITableViewCell来完成。 – Darren 2012-03-29 21:36:03
你能发布你的'cellForRowAtIndexPath:'吗?这可能与您如何创建单元格有关。 – Gobot 2012-03-30 00:51:24