Skip to content

Instantly share code, notes, and snippets.

@danstepanov
Created February 8, 2016 08:08
Show Gist options
  • Save danstepanov/7bf6c44dbc138a690949 to your computer and use it in GitHub Desktop.
Save danstepanov/7bf6c44dbc138a690949 to your computer and use it in GitHub Desktop.

Revisions

  1. danstepanov revised this gist Feb 8, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion labelConstraints.swift
    Original file line number Diff line number Diff line change
    @@ -10,7 +10,7 @@ func labelConstraints() {
    constant: 0.0)
    .active = true

    // Set Width to be 30% of the Page View Width
    // Set Width to be 80% of the Page View Width
    NSLayoutConstraint(
    item: label,
    attribute: .Width,
  2. danstepanov created this gist Feb 8, 2016.
    34 changes: 34 additions & 0 deletions labelConstraints.swift
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,34 @@
    func labelConstraints() {
    // Center button in Page View
    NSLayoutConstraint(
    item: label,
    attribute: .CenterX,
    relatedBy: .Equal,
    toItem: view,
    attribute: .CenterX,
    multiplier: 1.0,
    constant: 0.0)
    .active = true

    // Set Width to be 30% of the Page View Width
    NSLayoutConstraint(
    item: label,
    attribute: .Width,
    relatedBy: .Equal,
    toItem: view,
    attribute: .Width,
    multiplier: 0.8,
    constant: 0.0)
    .active = true

    // Set Y Position Relative to Bottom of Page View
    NSLayoutConstraint(
    item: label,
    attribute: .CenterY,
    relatedBy: .Equal,
    toItem: view,
    attribute: .CenterY,
    multiplier: 1.0,
    constant: 0.0)
    .active = true
    }