From the course: Advanced iOS App Development: Core Animation

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Using fill modes

Using fill modes - iOS Tutorial

From the course: Advanced iOS App Development: Core Animation

Start my 1-month free trial

Using fill modes

- [Instructor] The FillMode property controls how the animation behaves at the beginning and end of its run. So to see how that works, let's pop into the animation helper, and in our basic fade animation, let's set fadeIn.fillMode to kCAFillModeBackwards. Now there are four options for FillMode, so let's do a quick tour of what each of them has to offer, and how they effect our animations. If the FillMode property is not explicitly set it defaults to kCAFillModeRemoved, which just plays the animation from the begin time, or if that's not set it just plays immediately, and removes the last frame after the animation is complete. kCAFillModeBackwards immediately shows the first frame of the animation, even if there are delays set, and then plays it through. This is the one we'll want to use for the fade-in, so that all three views are hidden when the screen loads. kCAFillModeForwards is the exact opposite, playing the animation but showing the last frame on screen until it's manually…

Contents