I am making an iOS App. I have several CALayer objects that eventually will be deleted by a (shrinking) animation. When the animatio
See if this answer helps: Perform an action after the animation has finished I find animateWithDuration:animations:completion: to be way easier to use than working directly with CALayer. You can chain multiple animations via the completion handler and then remove the layer in the last one. eg:
[UIView animateWithDuration:1.0 animations:^{
// do first animation in the sequence
} completion:^(BOOL finished) {
[UIView animateWithDuration:1.0 animations:^{
// do second animation in the sequence
} completion:^(BOOL finished) {
[UIView animateWithDuration:1.0 animations:^{
// do third animation in the sequence
} completion:^(BOOL finished) {
// remove layer after all are done
}];
}];
}];
Possibly a little messy this way, but you could refactor these into their own method calls, for instance.