UITableViewCell防止删除
答
实施editingStyleForRowAtIndexPath和该行返回UITableViewCellEditingStyleNone:
- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath
{
if (indexPath.section == sss && indexPath.row == rrr)
return UITableViewCellEditingStyleNone;
else
return UITableViewCellEditingStyleDelete;
}
答
接受的响应作品,但不这样做的正确方法。有两种方法:editingStyleForRowAtIndexPath
和canEditRowAtIndexPath
editingStyleForRowAtIndexPath:使用时,有在表
canEditRowAtIndexPath多种不同的编辑风格:使用时,一些行应该编辑和一些不应该。
因此实现你的表委托正确的做法是:
- (BOOL)tableView:(UITableView *)tableView
canEditRowAtIndexPath:(NSIndexPath *)indexPath {
if (indexPath.section == sss && indexPath.row == rrr)
{
return NO;
}
return YES;
}
这就是我认为这将是......非常感谢您的回答! – Pripyat 2010-05-10 21:14:12