Skip to content

Instantly share code, notes, and snippets.

@Kievkao
Last active November 2, 2016 20:17
Show Gist options
  • Select an option

  • Save Kievkao/f8723e6f0579b4665eda3dc267cc9084 to your computer and use it in GitHub Desktop.

Select an option

Save Kievkao/f8723e6f0579b4665eda3dc267cc9084 to your computer and use it in GitHub Desktop.
Center view using VFL
NSArray *horizontalConstraints = [NSLayoutConstraint constraintsWithVisualFormat:@"V:[superview]-(<=1)-[label]" options:NSLayoutFormatAlignAllCenterX metrics:nil views:@{@"superview": self, @"label" : self.timeLabel}];
NSArray *verticalConstraints = [NSLayoutConstraint constraintsWithVisualFormat:@"H:[superview]-(<=1)-[label]" options: NSLayoutFormatAlignAllCenterY metrics: nil views:@{@"superview": self, @"label" : self.timeLabel}];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment