Animating Constraints

Recipe 5-1 moves a view by removing a constraint that aligns the view to the top or bottom and adding an inverse constraint. The following snippet from Recipe 5-1 moves the view from the top to the bottom:

NSLayoutConstraint * constraintToMatch =     [NSLayoutConstraint constraintWithItem:view1         attribute:NSLayoutAttributeTop         relatedBy:NSLayoutRelationEqual toItem:self.view         attribute:NSLayoutAttributeTop multiplier:1.0f constant:0]; [self.view removeMatchingConstraint: constraintToMatch]; NSLayoutConstraint * updatedConstraint =     [NSLayoutConstraint constraintWithItem:view1         attribute:NSLayoutAttributeBottom         relatedBy:NSLayoutRelationEqual toItem:self.view ...

Get The Core iOS Developer’s Cookbook, Fifth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.