smileyborg/UIView-AutoLayout — pull request #10 by caoimghgin (2014-04-06 15:30:50+00:00)
Title: Added methods for use in autoLayout against column views technique

Methods will align leading and trailing edges against one or more
views. For use in an autoLayout defined by UIView columns technique.

//
// Example code
//
- (void)updateConstraints
{
[super updateConstraints];

NSString *visualFormat = @"H:|-[col1(<=1000)]-[col2(==col1)]-[col3(==col1)]-[col4(==col1)]-[col5(==col1)]-[col6(==col1)]-|";
NSDictionary *metrics = nil;
NSDictionary *views = @{@"col1":self.col1, @"col2":self.col2, @"col3":self.col3, @"col4":self.col4, @"col5":self.col5, @"col6":self.col6};
[self addConstraints: [NSLayoutConstraint constraintsWithVisualFormat:visualFormat options:NSLayoutFormatAlignAllTop metrics:metrics views:views]];

CGFloat rowHeight = 44.0f;
CGFloat rowGutter = 10.0f;
CGFloat topInset = 100.0f;

// Row 1
[self.lastName autoPinEdge:ALEdgeTop toEdge:ALEdgeTop ofView:self withOffset:topInset relation:NSLayoutRelationEqual];
[self.lastName autoPinLeadingEdgeToView:self.col1 andTrailingEdgeToView:self.col2 forHeight:rowHeight];

[self.firstName autoPinEdge:ALEdgeTop toEdge:ALEdgeTop ofView:self withOffset:topInset relation:NSLayoutRelationEqual];
[self.firstName autoPinLeadingEdgeToView:self.col3 andTrailingEdgeToView:self.col4 forHeight:rowHeight];

[self.middleName autoPinEdge:ALEdgeTop toEdge:ALEdgeTop ofView:self withOffset:topInset relation:NSLayoutRelationEqual];
[self.middleName autoPinLeadingEdgeToView:self.col5 andTrailingEdgeToView:self.col6 forHeight:rowHeight];

}