iOS - UITableView - 取消删除行 - 按钮动画仅适用于附件视图

use*_*037 6 cocoa-touch uitableview ios

概述(已编辑)

我有UITableView,当我滑动时,会出现删除按钮,当我触摸其他位置时,删除按钮就会消失而没有任何动画.

随附配件

  • 如果我添加附件(Disclosure Indicator),当取消删除时,删除按钮会随着动画而消失.

没有附件

  • 如果我从表格视图单元格中删除附件,则删除取消不会显示任何动画.

  • 我不想要配件,但我想删除取消动画,有没有办法实现这个?

J. *_*sta 2

在 iOS 6 上这个“bug”仍然存在。有 2 种方法可以解决此问题:

解决方案一:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    //[...]
    cell.accessoryView = [UIView new];
    //[...]
}
Run Code Online (Sandbox Code Playgroud)

解决方案2

- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
    cell.accessoryView = [UIView new];
}
Run Code Online (Sandbox Code Playgroud)

这样,当取消“删除行”时,按钮会随着动画消失。