Filtering NSLayoutConstraints
This is a handy way to isolate an auto layout constraint in an iOS6+ app. Once you've got the constraint isolated, you can remove it, animate it, etc.
NSArray *constraints = [self.view constraints];
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"constant = %f", 64.0];
NSArray *filteredArray = [constraints filteredArrayUsingPredicate:predicate];
NSLayoutConstraint *constraint = [filteredArray objectAtIndex:0];
Other handy predicates for this filter are found in the NSLayoutConstraint docs
Written by Sol Irvine
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Cocoa touch
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#