Tricky
Tricky

Reputation: 7165

How can I get a core animation Explicit animation to behave in exactly the same way as an Implicit animation?

I wish to do some custom animation using core animation but am having the (no doubt) classic problem of animations resetting when they have completed.

Of course this can be stopped by using:

[animation setFillMode:kCAFillModeForwards];
[animation setRemovedOnCompletion: YES];

However, I am then left with a layer that won't respond to requests to move it as an animation remains in place.

I could remove the animation, but then the position is lost... plus it all seems too complicated for something that should be achievable simply...

What I would like is that when the animation is complete, the animation leaves the layer where it left it, and then disappears as if it was never even there.

The same behaviour as an implicit animation. How can this be achieved?

At the moment I'm having to set the animation delegate and listen out for animationDidStop:finished: calls, where I then have to disable implicit animations, set the value/s from the presentation layer, and commit the "animation".

There has to be an easier way...

Upvotes: 2

Views: 464

Answers (1)

KPM
KPM

Reputation: 10608

You might want to have a look at UIView displays improperly after its layer has been animated, your problem seems very similar.

Upvotes: 1

Related Questions