Skip to content

Instantly share code, notes, and snippets.

@Kievkao
Last active July 17, 2016 07:31
Show Gist options
  • Select an option

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

Select an option

Save Kievkao/47bfda1ae16a719c4f5ea7cdbb079f7a to your computer and use it in GitHub Desktop.
CenterConstraints
let xConstraint = NSLayoutConstraint(item: activity, attribute: .CenterX, relatedBy: .Equal, toItem: view, attribute: .CenterX, multiplier: 1.0, constant: 0)
let yConstraint = NSLayoutConstraint(item: activity, attribute: .CenterY, relatedBy: .Equal, toItem: view, attribute: .CenterY, multiplier: 1.0, constant: 0)
let widthConstraint = NSLayoutConstraint(item: activity, attribute: .Width, relatedBy: .Equal, toItem: nil, attribute: .Width, multiplier: 1.0, constant: 100)
let heightConstraint = NSLayoutConstraint(item: activity, attribute: .Height, relatedBy: .Equal, toItem: nil, attribute: .Height, multiplier: 1.0, constant: 100)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment