UITableView has that built-in animation in which after a cell is reordered, it lays gently into the vacant space. Is there a where to tap into some sort of notification after that animation ends? I would like to call a method upon completion. At the moment I'm using performSelector:withObject:afterDelay:
which works fine at the moment, but I would like to know if it's possible to tap into animation complete.
To reiterate, I'm not talking about custom animation, only the animation built into UITableView.
I've been searching around and can't seem to gather an answer.
I realize that this question is ancient, but I still stumbled across it when I was trying to find an answer to the same problem that @Gobot was having. Well, turns out that there is a SIMPLE solution. Like what @Mitchell Vanderhoeff stated, you need to insert the method
- (void)tableView:(UITableView *)tableView
moveRowAtIndexPath:(NSIndexPath *)fromIndexPath
toIndexPath:(NSIndexPath *)toIndexPath {
[CATransaction setCompletionBlock:^{
// Completion code here
}];
}
in your tableview delegate to get notice from the tableview that it's about to move a row. The key though is the CATransaction setCompletionBlock. This will let you set a completion block on the implicit animation transaction which the tableview is doing for the row movement. Just like the name implies, whatever you put in that block will be executed after the animation has completed.
You will need to include the QuartzCore framework if it's not already part of your project.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With