Last active
August 29, 2015 14:18
-
-
Save iltercengiz/3f2ed5d3c21be4d252ba to your computer and use it in GitHub Desktop.
Variable Bindings
This file contains 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
NSArray *constraints = [NSLayoutConstraint constraintsWithVisualFormat:@"V:|-[redView(==blueView)]-0-[blueView]-|" | |
options:0 | |
metrics:nil | |
views:@{@"redView": redView, | |
@"blueView": blueView}]; | |
[self.view addConstraints:constraints]; |
This file contains 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
NSDictionary *views = NSDictionaryOfVariableBindings(redView, blueView); | |
NSArray *constraints = [NSLayoutConstraint constraintsWithVisualFormat:@"V:|-[redView(==blueView)]-0-[blueView]-|" | |
options:0 | |
metrics:nil | |
views:NSDictionaryOfVariableBindings(redView, blueView)]; | |
[self.view addConstraints:constraints]; | |
constraints = [NSLayoutConstraint constraintsWithVisualFormat:@"H:|-[redView]-|" | |
options:0 | |
metrics:nil | |
views:views]; | |
[self.view addConstraints:constraints]; | |
constraints = [NSLayoutConstraint constraintsWithVisualFormat:@"H:|-[blueView]-|" | |
options:0 | |
metrics:nil | |
views:views]; | |
[self.view addConstraints:constraints]; |
This file contains 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
NSDictionaryOfVariableBindings(redView, blueView) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment