Skip to content

Instantly share code, notes, and snippets.

@jcromartie
Created March 1, 2013 15:45
Show Gist options
  • Select an option

  • Save jcromartie/5065496 to your computer and use it in GitHub Desktop.

Select an option

Save jcromartie/5065496 to your computer and use it in GitHub Desktop.
NSDictionary *metrics = @{@"padding": @25};
NSDictionary *views = NSDictionaryOfVariableBindings(imageView, thumbnailsView, container, titleLabel);
void (^addConstraint)(NSString *) = ^(NSString *format) {
[mainView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:format options:0 metrics:metrics views:views]];
};
addConstraint(@"|-padding-[thumbnailsView]-padding-|");
addConstraint(@"V:[thumbnailsView(==100)]-padding-|");
addConstraint(@"|-padding-[imageView][thumbnailsView]");
addConstraint(@"|-padding-[container]-padding-|");
addConstraint(@"V:|-padding-[container][thumbnailsView]|");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment