I'm trying to wait for an animation to finish before starting another task. I looked at different methods but using CATransactions seems to be the most used method to do this. Somehow, my CATransaction Completionblock triggers immediately after the animation starts, not after it finishes.
Here's my code:
[CATransaction begin];
[CATransaction setCompletionBlock: ^{
NSLog(@"Animation ends");
}];
NSLog(@"Animation begins");
[tableView setEditing:NO animated:YES];
[CATransaction commit];
When looking at the console I get this:
2014-03-17 15:44:12.995 BarTap[89934:70b] Animation begins
2014-03-17 15:44:12.997 BarTap[89934:70b] Animation ends
So appearently the Completionblock starts 0.002 seconds after the animation begins, but the animation definitely takes longer than that. Could anyone help me? Thanks!