views:

128

answers:

1

The documentation is not talking really much about what this technically does.

fadeInAnimation.fillMode = kCAFillModeForwards;

I don't really see the effect of this. I have an view with alpha set to 0.0. Then I fade it in. But when I uncomment the line abouth, nothing changes. Same behavior. I'd like to understand what this fillMode really does.

+1  A: 

From the CAMediaTiming protocol documentation:

Determines if the receiver’s presentation is frozen or removed once its active duration has completed.

This determines what happens at the end of your animation. By default, it is set to kCAFillModeRemoved, which means that the animation changes are undone when the animation is completed. If you switch it to kCAFillModeForwards, the changes caused by the animation will hang around.

Note that you will also probably need to set the removedOnCompletion property to NO to prevent your animation from being removed, which would make this setting ineffective.

Brad Larson
Great explanation! Yes, I have the removedOnCompletion set to NO. That's why I see no changes in the fillMode, right? Why is that called "fillMode"? So internally it's nothing more than keeping the new calculated parameters after all the animation interpolation routines?
Thanks