【发布时间】:2011-08-11 16:16:20
【问题描述】:
我有一个可编辑的分组 tableView,但滑动删除不起作用。看起来滑动删除应该与 UITableViewCellEditingStyleDelete 一起出现,但对我来说似乎不是。这是我的编辑风格方法:
- (UITableViewCellEditingStyle)tableView:(UITableView *)table editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath
{
if (indexPath.section == 1)
{
if (indexPath.row < [[device_coordinator getChannelList] count]) return UITableViewCellEditingStyleDelete;
else if (indexPath.row < [[device_coordinator getChannelList] count]+2) return UITableViewCellEditingStyleInsert;
}
return UITableViewCellEditingStyleNone;
}
这使表格看起来正确。有些单元格在左侧有插入图标,有些单元格有删除图标,因为它们应该。按下删除图标会出现删除确认按钮。但是滑动不会!
即使我只是从我的 cellForRowAtIndexPath 方法返回空白的、新分配的单元格,它仍然无法工作,因此看来我的单元格中没有任何内容导致问题。同样的问题发生在 4.3 模拟器和我的 iPod touch 2g 上。
【问题讨论】:
标签: iphone objective-c ios uitableview