Skip to content

Instantly share code, notes, and snippets.

@gazolla
Created December 27, 2014 02:47
Show Gist options
  • Save gazolla/76835584c7205218c8f6 to your computer and use it in GitHub Desktop.
Save gazolla/76835584c7205218c8f6 to your computer and use it in GitHub Desktop.
Auto Layout - how to follow superview
NSDictionary* views = @{@"collectionView": self.collection};
NSArray* sHorizontal = [NSLayoutConstraint constraintsWithVisualFormat:@"H:|[collectionView]|"
options:0
metrics:nil
views:views];
NSArray* sVertical = [NSLayoutConstraint constraintsWithVisualFormat:@"V:|[collectionView]|"
options:0
metrics:nil
views:views];
[self.view addConstraints:sHorizontal];
[self.view addConstraints:sVertical];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment