Iphone UITableView提交的编辑样式,不删除单元格

Iphone UITableView提交的编辑样式,不删除单元格,iphone,objective-c,ios,uitableview,Iphone,Objective C,Ios,Uitableview,我对在UITableView中删除行的概念有一个小问题。用户删除我不想激发的行后: [self.tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationRight]; 相反,我希望在不隐藏的情况下更改编辑的单元格文本和背景。我的方法非常有效: 但删除一行后,它不会提交在当前单元格上取消“删除”标签的动画。有没有办法绕过“苹果方

我对在UITableView中删除行的概念有一个小问题。用户删除我不想激发的行后:

    [self.tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationRight];
相反,我希望在不隐藏的情况下更改编辑的单元格文本和背景。我的方法非常有效:

但删除一行后,它不会提交在当前单元格上取消“删除”标签的动画。有没有办法绕过“苹果方式”删除行

编辑-我已经算出了

很简单,很简单。只需将deleteRowsAtIndexPaths替换为:

    [self.tableView reloadRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationAutomatic];

“删除”动画消失后,单元格仍在原来的位置。

我正在使用此代码,它工作正常

//self.selectedMessageIndex is NSIndexPath object declared in header file
//self.attachments is a NSMutableArray Object

[self.attachments removeObjectAtIndex:self.selectedMessageIndex.row];

[tblvAttachmentsList deleteRowsAtIndexPaths:[NSArray arrayWithObject:self.selectedMessageIndex]
                                  withRowAnimation:UITableViewRowAnimationLeft];
[tblvAttachmentsList reloadData];
你的意思是“删除”按钮保持不变,即使你按下了它?在我的iOS 5.1模拟器上 按“删除”并清空:

- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
“删除”按钮消失

self.tableView.reloadRowsAtIndexPaths([indexPath], withRowAnimation:.Automatic)
这将删除带有漂亮动画的删除按钮。调用,当您知道不打算删除该行时:

func tableView(tableView: UITableView, commitEditingStyle editingStyle:UITableViewCellEditingStyle, forRowAtIndexPath indexPath:NSIndexPath) {
    if (editingStyle == UITableViewCellEditingStyle.Delete) {

        //An action happens here. If it was successful, page is refreshed
        //If the action fails, cell stays. I am showing an error and:
        self.tableView.reloadRowsAtIndexPaths([indexPath], withRowAnimation:.Automatic)
    }
}

我真的不想提交删除动画。我只想让行保持原位,但颜色/背景等不同。这就是问题所在。我们真的需要在这里使用“重新加载数据”吗?我认为没有必要。请将此方法留空,然后查看按delete键时发生的情况。只需在开头和结尾分别写上/*和*/就行了。谢谢你,在你发完帖子后,我决定让这个方法空着,然后用我的单元格进行操作。这就解决了我的问题(太简单了):)。
func tableView(tableView: UITableView, commitEditingStyle editingStyle:UITableViewCellEditingStyle, forRowAtIndexPath indexPath:NSIndexPath) {
    if (editingStyle == UITableViewCellEditingStyle.Delete) {

        //An action happens here. If it was successful, page is refreshed
        //If the action fails, cell stays. I am showing an error and:
        self.tableView.reloadRowsAtIndexPaths([indexPath], withRowAnimation:.Automatic)
    }
}