UITableView可编辑(可重排),没有单元格可删除

时间:2010-02-17 14:25:59

标签: iphone objective-c

我想知道是否有办法让用户能够重新排列(移动)单个TableViewCells的方式使UITableView可编辑,但不显示“Remove-Cell”特征。

谢谢你的帮助

SAM

2 个答案:

答案 0 :(得分:21)

您是否尝试过实现editingStyleForRowAtIndexPath方法并返回UITableViewCellEditingStyleNone?

答案 1 :(得分:0)

根据您的要求更改 if condition

- (UITableViewCellEditingStyle)tableView:(UITableView *)aTableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath
{
      // in below if your write your condition on which delete is enable or disable
 if ([[friednListArr objectAtIndex:indexPath.row][@"id"] isEqualToString:user.userId]) {
    return UITableViewCellEditingStyleNone;
}
 else{
     return UITableViewCellEditingStyleDelete;
     }
}