Skip to content

Instantly share code, notes, and snippets.

@sebk
Last active December 27, 2015 04:29
Show Gist options
  • Save sebk/7267649 to your computer and use it in GitHub Desktop.
Save sebk/7267649 to your computer and use it in GitHub Desktop.
Change the size of a UIView with autolayout programmatically
//_constraintHeight and _constraintWidht are IBOutlet NSLayoutConstraints (from _theView), defined in xib
_constraintHeight.constant = NEW_HEIGHT;
_constraintWidth.constant = NEW_WIDTH;
[_theView setNeedsUpdateConstraints];
[UIView animateWithDuration:((animated) ? ANIMATION_DURATION : 0.0) animations:^{
[_theView layoutIfNeeded];
}];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment