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.
Custom button animations - iOS Tutorial
From the course: Learning iOS Animations with UIKit
Custom button animations
- [Instructor] One thing you might have noticed is that if we repeatedly click register, the continue button is going to keep moving down by 50 pixels each time. Don't worry about this right now since the chapter challenge will be to reverse the register transition animation combo when sign in is selected. All right, so let's go back into our code and add in a nice popping effect when the continue button is pressed. Now we could do this in the springs and transitions view controller, but it's going to be cleaner if we separate this off into the CustomButton class. Head over into the views subfolder and select CustomButton and let's declare a new function under setup. We're going to call this function selectionAnimation. It's going to take in no parameters and we need to expose it to objc so that we can pass it in to the button's target action selector. Now for the animation itself, I want the button to jump up just a tiny bit, scale in the x and y direction so it looks like it pops…
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.