Skip to content

Instantly share code, notes, and snippets.

@mluton
Created November 5, 2012 20:07
Show Gist options
  • Select an option

  • Save mluton/4020043 to your computer and use it in GitHub Desktop.

Select an option

Save mluton/4020043 to your computer and use it in GitHub Desktop.
Center a View With Autolayout Constraints
self.noFavoritesImageViewCenterXConstraint = [NSLayoutConstraint constraintWithItem:self.noFavoritesImageView attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeCenterX multiplier:1.0f constant:0];
self.noFavoritesImageViewCenterYConstraint = [NSLayoutConstraint constraintWithItem:self.noFavoritesImageView attribute:NSLayoutAttributeCenterY relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeCenterY multiplier:1.0f constant:0];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment