Reputation: 3852
I have grouped 4 CABasicAnimation into CAAnimationGroup. But the problem is that
-(void) animationDidStop:(CAAnimation *)anim finished:(BOOL)flag
is not called for each animation.
CABasicAnimation *anim1;//code of anim1
anim1.deleagte=self;
CABasicAnimation *anim2://code of anim2
anim2.deleagte=self;
CABasicAnimation *anim3;//code of anim3
anim3.deleagte=self;
CABasicAnimation *anim4://code of anim4
anim4.deleagte=self;
CAAnimationGroup *animGrp;//code of animGrp
animGrp.delegate=self;
[imageView.layer addAnimation:animGrp forKey:@""];
Am I doing something wrong or there is different approach to it.
My aim is to change the position of the UIIImageView for every animation.
So, when anim1 ends I want to change Image, but I don't receive a animationDidStop delegate.
Upvotes: 2
Views: 2058
Reputation: 3173
The documentation states
`CAAnimationGroup` allows multiple animations to be grouped and run concurrently
and
Note: The delegate and removedOnCompletion properties of animations in the animations property are currently ignored.
You can use the beginTime
of an animation to start one animation in the group after another one has finished by simply setting the beginTime
to the duration of the other animation. Time Warp in Animation provides a nice explanation of the properties that are inherited from the CAMediaTiming
protocol. However, in your case it might be more convenient to add one animation to the layer and register it using the delegate and add another one to the layer after the first one has finished.
Upvotes: 3