Why my spring-label-label-spring auto layout constraints don't work?
<p>I am trying to horizontally center labels within its container, using UIView acting as springs on the two sides.</p>

<p>Unfortunately, the system tells it can satisfy all constraints, hence the wrong result. But I can come up with a solution.</p>

<p>My code is as follows:</p>

<pre><code> func addSpringConstraints(items: [UIView], mainView: UIView, spacing: CGFloat) {

    let pad = spacing / 2

    var constraints = [NSLayoutConstraint]()


    // Add two spacer to serve as springs
    let lSpring = UIView()
    lSpring.frame.size.width = 50
    //lSpring.hidden = true
    lSpring.backgroundColor = UIColor.redColor().colorWithAlphaComponent(0.5)
    lSpring.translatesAutoresizingMaskIntoConstraints = false
    addSubview(lSpring)

    let rSpring = UIView()
    rSpring.frame.size.width = lSpring.frame.size.width
    //rSpring.hidden = true
    rSpring.backgroundColor = UIColor.blueColor().colorWithAlphaComponent(0.5)
    rSpring.translatesAutoresizingMaskIntoConstraints = false
    addSubview(rSpring)


    // Constraint left spring
    constraints.append(NSLayoutConstraint(item: lSpring, attribute: .Top,    relatedBy: .Equal, toItem: mainView, attribute: .Top,    multiplier: 1, constant: 0))
    constraints.append(NSLayoutConstraint(item: lSpring, attribute: .Bottom, relatedBy: .Equal, toItem: mainView, attribute: .Bottom, multiplier: 1, constant: 0))
    constraints.append(NSLayoutConstraint(item: lSpring, attribute: .Left,   relatedBy: .Equal, toItem: mainView, attribute: .Left,   multiplier: 1, constant: 0))


    // Constraint right spring
    constraints.append(NSLayoutConstraint(item: rSpring, attribute: .Top,    relatedBy: .Equal, toItem: mainView, attribute: .Top,    multiplier: 1, constant: 0))
    constraints.append(NSLayoutConstraint(item: rSpring, attribute: .Bottom, relatedBy: .Equal, toItem: mainView, attribute: .Bottom, multiplier: 1, constant: 0))
    constraints.append(NSLayoutConstraint(item: rSpring, attribute: .Right,  relatedBy: .Equal, toItem: mainView, attribute: .Right,  multiplier: 1, constant: 0))


    for (index, segment) in items.enumerate() {

        // Add top and bottom constraints

        constraints.append(NSLayoutConstraint(item: segment, attribute: .Top,    relatedBy: .Equal, toItem: mainView, attribute: .Top,    multiplier: 1, constant: 0))
        constraints.append(NSLayoutConstraint(item: segment, attribute: .Bottom, relatedBy: .Equal, toItem: mainView, attribute: .Bottom, multiplier: 1, constant: 0))


        // Add left constraint if any and width constraint

        if index == 0 {
            let prev = lSpring          // first label is attached to the left spring
            constraints.append(NSLayoutConstraint(item: segment, attribute: .Left, relatedBy: .Equal, toItem: prev, attribute: .Right, multiplier: 1, constant: 0))
        }
        else {
            let prev = items[index-1]   // label attached to the previous label by its left side
            constraints.append(NSLayoutConstraint(item: segment, attribute: .Left, relatedBy: .Equal, toItem: prev, attribute: .Right, multiplier: 1, constant: pad))

            // Same width than first segment
            constraints.append(NSLayoutConstraint(item: segment, attribute: .Width, relatedBy: .Equal, toItem: items.first, attribute: .Width, multiplier: 1, constant: 0))
        }


        // Add right constraints if any

        if index == items.count - 1 {
            let next = rSpring          // last label is attached to the right spring
            constraints.append(NSLayoutConstraint(item: segment, attribute: .Right, relatedBy: .Equal, toItem: next, attribute: .Left, multiplier: 1, constant: 0))
        }
        else {
            let next = items[index+1]   // label attached to the next label by its right side
            constraints.append(NSLayoutConstraint(item: segment, attribute: .Right, relatedBy: .Equal, toItem: next, attribute: .Left, multiplier: 1, constant: -pad))
        }
    }

    // Add all constraints to the view
    mainView.addConstraints(constraints)
}
</code></pre>

<p>Here is the issues for spring -"PHOTO" - "LIVE VIDEO" - spring :</p>

<pre><code>Unable to simultaneously satisfy constraints.
    Probably at least one of the constraints in the following list is one you don't want. 
    Try this: 
        (1) look at each constraint and try to figure out which you don't expect; 
        (2) find the code that added the unwanted constraint or constraints and fix it. 
    (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints) 
(
    "&lt;NSAutoresizingMaskLayoutConstraint:0x14ddf0d60 h=--&amp; v=--&amp; H:[Visage.ZEENSUISegmentedControl:0x14df01300(0)]&gt;",
    "&lt;NSLayoutConstraint:0x14dec1490 H:|-(0)-[UIView:0x14debe390](LTR)   (Names: '|':Visage.ZEENSUISegmentedControl:0x14df01300 )&gt;",
    "&lt;NSLayoutConstraint:0x14deaabb0 UIView:0x14deaaa40.right == Visage.ZEENSUISegmentedControl:0x14df01300.right&gt;",
    "&lt;NSLayoutConstraint:0x14deb7780 H:[UIView:0x14debe390]-(0)-[UILabel:0x14df3af70'PHOTO'](LTR)&gt;",
    "&lt;NSLayoutConstraint:0x14deaada0 UILabel:0x14df3af70'PHOTO'.right == UILabel:0x14debe9e0'LIVE VIDEO'.left - 22.5&gt;",
    "&lt;NSLayoutConstraint:0x14dea5930 UILabel:0x14debe9e0'LIVE VIDEO'.width == UILabel:0x14df3af70'PHOTO'.width&gt;",
    "&lt;NSLayoutConstraint:0x14dea5980 UILabel:0x14debe9e0'LIVE VIDEO'.right == UIView:0x14deaaa40.left&gt;"
)
</code></pre>