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.

Reusing animations

Reusing animations - iOS Tutorial

From the course: Advanced iOS App Development: Core Animation

Start my 1-month free trial

Reusing animations

- [Instructor] To get a handle on how reusing layer animation works. We're going to add the fade animation on the username and password text fields. And for a bit more effect will add in delays for each of the animations. For all let's do a little bit of refactoring and organization. Gonna cut and copy the code we wrote from the last video. And under the animations mark, just gonna create a new function, called fade in views. It's not gonna return anything. It's just for organization. And I'm going to call this in view did appear, So this way we have all of our first animation code right in one place where we can look at it. Now as you might of guessed since our fade animation is an object and it's copied. Whenever it's added to a layer we can reuse it simply by adding the animation object to another view. So right after our tile label dot layer add we're gonna say username field dot layer dot add. And we're just gonna add fade to it again with a key of nil. We're gonna do the same…

Contents