如何在UITableViewCell上检测动画何时完成取消选择行

Awe*_*e-o 6 objective-c uitableview

选择UITableViewCell之后我打电话

[tableView deselectRowAtIndexPath:indexPath animated:YES]

tableView:didSelectRowAtIndexPath:

这会显示取消选择动画.我想知道是否有任何方法可以检测此动画何时完成.

Mik*_*lor 9

[CATransaction begin];

[tableView beginUpdates];

[CATransaction setCompletionBlock: ^{

    NSLog(@"Completion code here");

}];

[tableView deselectRowAtIndexPath:indexPath animated:YES];
[tableView endUpdates];

[CATransaction commit];
Run Code Online (Sandbox Code Playgroud)

  • 谢谢你的回答.仅供未来观众参考 - 我不认为在这个特定的例子中,`beginUpdates`和`endUpdates`调用是绝对必要的.这些方法用于在单个动画中将多个动作组合在一起,但由于此示例只有一个取消选择动作,您也可以将它们留在此处. (2认同)