From the course: Learning iOS Animations with UIKit

Unlock the full course today

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

Chapter challenge

Chapter challenge - iOS Tutorial

From the course: Learning iOS Animations with UIKit

Start my 1-month free trial

Chapter challenge

(swish) - [Instructor] For this challenge, you'll be completing our bouncing ball animation by adding in the last key frame to move the ball back to its original position from screen left. Now, there are two ways of setting the ball's position at the bottom of the screen with our current setup. The first option is you can use the screen bottom property in our animation manager, which'll work just fine. The other option is to store the ball's origin right before calling animate key frames and then using that local variable to set the last key frame. Now the choice is really up to you, both will work. I favor the second way of doing things just out of habit. Since having an animated view origin makes things a lot simpler and cleaner when dealing with coordinate systems. You're not always going to be ending an animation at a nice easily computed point like the bottom of the screen. This one shouldn't take you more than a couple minutes, so give it a shot, and head over the solution to…

Contents