From the course: Learning iOS Animations with UIKit
Unlock the full course today
Join today to access over 22,700 courses taught by industry experts or purchase this course individually.
Adding and removing constraints - iOS Tutorial
From the course: Learning iOS Animations with UIKit
Adding and removing constraints
- [Instructor] Now that we know how to update and animate a single constraint property, how do we manage a total constraint replacement? Well, if you still got your debug console open, you'll see that the status of the constraint is printed out in the description. This gives us a clue as to how we can swap constraints programmatically. The first thing we need to do is find the constraint we want to delete. For this example, we're going to swap out the Welcome label's top constraint so it moves up in sync with the newsletter height increase. Let's open up the main storyboard, select the welcome label, and mouse over the top constraint. Go head and open up your utilities fold out and let's set the identifier to welcome label top and hit enter. Now, back in the view controller underneath animate newsletter height, let's start ourselves a new function. We'll call it animateWelcomeLabel. Now in here, we're going to use the same process to find our constraint so if let welcomeTop equals…
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.