6

After selecting a UITableViewCell I call

[tableView deselectRowAtIndexPath:indexPath animated:YES]

inside tableView:didSelectRowAtIndexPath:

This displays a deselection animation. I'd like to know if there is any way to detect when this animation completes.

Awesome-o
  • 2,002
  • 1
  • 26
  • 38
  • 2
    I would try wrapping this statement in a `CATransaction` with a completion block as described in [this question](http://stackoverflow.com/questions/3832474/uitableview-row-animation-duration-and-completion-callback). – Timothy Moose Oct 11 '13 at 02:25

1 Answers1

9
[CATransaction begin];

[tableView beginUpdates];

[CATransaction setCompletionBlock: ^{

    NSLog(@"Completion code here");

}];

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

[CATransaction commit];
Mike Mellor
  • 1,316
  • 17
  • 22
  • 2
    Thanks for the answer. FYI to future viewers -- I don't believe the `beginUpdates` and `endUpdates` calls are strictly necessary in this particular example. Those methods are used to group together multiple actions in a single animation, but since this example only has one deselection action, you could also leave them out here. – Matt Jan 16 '15 at 03:28