I have a problem with Cocoa Auto Layout and can\'t get my head around this problem. All I\'d like to achieve is to have two buttons always centered in a view as depicted below.<
A neat trick with Auto Layout is to use invisible views as spacers. The constraint system still lays them out as normal. In this case, that space between the two buttons can be an invisible view. You can use the constraints from this constraint string:
@"[button][invisibleView(5)][button2(==button)]"
Then create a constraint setting invisibleView.centerX = superview.centerX
.