Correct way to prevent layer fading in CABasicAnimation?

I am animating a CALayer using CABasicAnimation and expect the layer to stay in position when the animation finishes. Almost all solutions show the following, which works great

animation.removedOnCompletion = NO;
animation.fillMode = kCAFillModeForwards;

However, the 2010 WWDC speaker in Core Animation in Practice Part 1 (~ 38-41mins) says that most solutions for the disappearing layer are found to be “fake,” and the correct way to animate the layer is something like the following

animation.fromValue = [NSNumber numberWithFloat:layer.position.y];
layer.position = CGPointMake(layer.position.y, endPoint); 
animation.toValue = [NSNumber numberWithFloat:endPoint];

The reason given is that the removedOnCompletion / fillMode solution only delays the presentation level, and the actual level still has its original position.

Please correct me if I misunderstood the speaker.

If I understood it correctly, when does it matter?

Thanks Steve

+5
2

, ... .

, ", " " ". . ( UIView CALayer , " " " ", ).

- ... , !

+2

.

, , "" , " ", , . , "" .

+1

All Articles