Auto Layout is making my life difficult. In theory, it was going to be really useful when I switched, but I seem to fight it all of the time.
I\'ve made a demo proje
Another approach might be to have the top and bottom labels have constraints relative to the view top and bottom, respectively, and have the middle view have top and bottom constraints relative to the first and third view, respectively.
Note that you have more control over constraints than it might seem by dragging views close to one another until guiding dashed lines appear - these indicate constraints between the two objects that will be formed instead of between the object and the superview.
In this case you would then want to alter the constraints to be "Greater than or equal to" the desired value, instead of "equal to" to allow them to resize. Not sure if this will do exactly what you want.
Very easy way to solve this in InterfaceBuilder:
Set the centered label (label2) to "Horizontal Center in Container" and "Vertical Center in Container"
Select the centered label and the top label (label1 + label2) and add TWO constraints for Vertical Spacing. One with Greater Than or Equal the min spacing. One with Less Than or Equal the max spacing.
The same for the centered label and the bottom label (label2 + label3).
Additionally you could also add two constraints to label1 - Top Space To SuperView and two constraints to label2 - Bottom Space To SuperView.
The result will be that all 4 spacings will change their sizes equally.
The correct and easiest way is to use Stack Views.
check https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/AutolayoutPG/AutoLayoutbyExample/AutoLayoutbyExample.html having nice description about solving your problem.
With labels this works fine at least:
@"H:|-15-[first(==second)]-[second(==third)]-[third(==first)]-15-|
If the first has the same width as the second, and second the third, and third the first, then they will all get the same width... You can do it both horizontally (H) and vertically (V).
I was able to solve this entirely in IB:
So if you have three labels, set the multipliers to each of those constraints to 0.1666667, 0.5, 0.833333.