Last active
December 22, 2015 17:09
-
-
Save charlesmchen/6504515 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| UIButton *button = ...; | |
| UIView *superview = ...; | |
| NSDictionary *variableMap = NSDictionaryOfVariableBindings(label, superview); | |
| NSLayoutConstraint *cn = [NSLayoutConstraint constraintsWithVisualFormat:@"V:[button]-12-[superview]" | |
| options:0 | |
| metrics:nil | |
| views:variableMap]; | |
| [superview addConstraint:cn]; | |
| cn = [NSLayoutConstraint constraintsWithVisualFormat:@"H:[superview]-(<=1)-[button]" | |
| options:NSLayoutFormatAlignAllCenterY | |
| metrics:nil | |
| views:variableMap]; | |
| [superview addConstraint:cn]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment