Skip to content

Instantly share code, notes, and snippets.

@iltercengiz
Last active Aug 29, 2015
Embed
What would you like to do?
Variable Bindings
NSArray *constraints = [NSLayoutConstraint constraintsWithVisualFormat:@"V:|-[redView(==blueView)]-0-[blueView]-|"
options:0
metrics:nil
views:@{@"redView": redView,
@"blueView": blueView}];
[self.view addConstraints:constraints];
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];
NSDictionaryOfVariableBindings(redView, blueView)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment