Ah! We should have seen this earlier. The problem is this line in your if (animated)
block:
self.innerPie.strokeEnd = progress;
Since innerPie is a Core Animation layer, this causes an implicit animation (most property changes do). This animation is fighting with your own animation. You can prevent this from happening by disabling implicit animation while setting the strokeEnd:
[CATransaction begin];
[CATransaction setDisableActions:YES];
self.innerPie.strokeEnd = progress;
[CATransaction commit];
(Note how setDisableActions:
is within the begin/commit.)
Alternatively, you can remove your own animation and just use the automatic one, using something like setAnimationDuration:
to change its length.
Original Suggestions:
My guess is that your drawRect:
is being called, which resets your strokeEnd value. Those layers should probably not be set up in drawRect:
anyway. Try moving that setup to an init method or didMoveToWindow:
or similar.
If that's not effective, I would suggest adding log statements to track the value of progress
and [self.innerPie.presentationLayer strokeEnd]
each time the method is called; perhaps they're not doing what you expect.