Skip to content

Instantly share code, notes, and snippets.

@kartikshah
Created January 6, 2014 05:52
Show Gist options
  • Save kartikshah/8278826 to your computer and use it in GitHub Desktop.
Save kartikshah/8278826 to your computer and use it in GitHub Desktop.
Autolayout and Orientation Blog entry - portrait gist
[_containerView addConstraints: [NSLayoutConstraint constraintsWithVisualFormat:@"|-[_leftOrTopView]-|" options:0 metrics:nil views:NSDictionaryOfVariableBindings(_leftOrTopView)]];
[_containerView addConstraints: [NSLayoutConstraint constraintsWithVisualFormat:@"|-[_rightOrBottomView]-|" options:0 metrics:nil views:NSDictionaryOfVariableBindings(_rightOrBottomView)]];
[_containerView addConstraints: [NSLayoutConstraint constraintsWithVisualFormat:@"V:|-[_leftOrTopView]-[_rightOrBottomView]-|" options:0 metrics:nil views:NSDictionaryOfVariableBindings(_leftOrTopView, _rightOrBottomView)]];
[_containerView addConstraint: [NSLayoutConstraint constraintWithItem:_leftOrTopView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:_rightOrBottomView attribute:NSLayoutAttributeWidth multiplier:1.0 constant:0 ]];
[_containerView addConstraint: [NSLayoutConstraint constraintWithItem:_leftOrTopView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:_rightOrBottomView attribute:NSLayoutAttributeHeight multiplier:1.0 constant:0]];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment