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 solution - iOS Tutorial
From the course: Learning iOS Animations with UIKit
Chapter solution
- [Instructor] Alright, let's jump right into the solution here. I'm inside the addDynamicInfoLabel function right at the bottom and I'm going to add in a simple animation with no spring motion or bells and whistles. I'm going to say UIView.animate. This is going to last for one second and inside here, I'm just going to change the xAnchor's constant value to half the newsletter view's width. So, I'm going to say xAnchor.constant equals self.newsletterView.frame.size.width divided by two. Now, if you tried to use the screen bounce property from our animation manager or even the newsletter center X value here, I really commend you for the great idea, but, unfortunately, you won't get the desired placement since the info label is a sub view of the newsletter view and the newsletter view is a sub view of the main super view, the center X values for both won't add up to the same position. Now, to round things off right here after our xAnchor, we're going to say…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.