Iphone 从表格视图单元格中删除删除按钮

Iphone 从表格视图单元格中删除删除按钮,iphone,cocoa-touch,uitableview,Iphone,Cocoa Touch,Uitableview,当按下表视图上的行删除按钮时,我会进行一些验证,如果用户选择取消操作,则所有操作都会回滚。不仅要保留该行正在发生的事情,还要使delete按钮消失,只留下-round按钮。我该怎么做 再次感谢。假设您正在UITableViewDatasource协议对象的tableView:CommittedItingStyle:forRowAtIndexPath:method中实现验证,您应该能够在单元格上设置editingAccessoryType和editingAccessoryView //After

当按下表视图上的行删除按钮时,我会进行一些验证,如果用户选择取消操作,则所有操作都会回滚。不仅要保留该行正在发生的事情,还要使delete按钮消失,只留下-round按钮。我该怎么做


再次感谢。

假设您正在UITableViewDatasource协议对象的tableView:CommittedItingStyle:forRowAtIndexPath:method中实现验证,您应该能够在单元格上设置editingAccessoryType和editingAccessoryView

//After validation fails....
UITableViewCell *aCell;  
aCell = [self tableView:tableView cellForRowAtIndexPath:indexPath];
// validations are done and you need to ignore the delete
if ( aCell.showingDeleteConfirmation ){
    aCell.editingAccessoryView = nil;
    aCell.editingAccessoryType = UITableViewCellAccessoryNone;

}
//After validation fails....
UITableViewCell *aCell;  
aCell = [self tableView:tableView cellForRowAtIndexPath:indexPath];
if ( aCell.showingDeleteConfirmation ){
    aCell.editing = NO;
    aCell.editingAccessoryView = nil;
    aCell.editing = YES;

}
如果需要,可以将更改包裹在动画块中以设置更改的动画

或者,您可以切换单元格的编辑状态

//After validation fails....
UITableViewCell *aCell;  
aCell = [self tableView:tableView cellForRowAtIndexPath:indexPath];
// validations are done and you need to ignore the delete
if ( aCell.showingDeleteConfirmation ){
    aCell.editingAccessoryView = nil;
    aCell.editingAccessoryType = UITableViewCellAccessoryNone;

}
//After validation fails....
UITableViewCell *aCell;  
aCell = [self tableView:tableView cellForRowAtIndexPath:indexPath];
if ( aCell.showingDeleteConfirmation ){
    aCell.editing = NO;
    aCell.editingAccessoryView = nil;
    aCell.editing = YES;

}

您好,您是否在uer取消后使用UITableView的reloadData方法?您好,ISDi,我正在使用操作表进行验证。下面的答案非常合适。谢谢。嗨,奇普,第二个解决方案是我的。工作完美。用户按下删除按钮;弹出验证行动单;用户选择取消删除操作;细胞变成初始状态。非常感谢。