I want my both "bubbles" be aligned to the left.
They are in a stackView with the symbol and the mailLabel.
For some reason shorter text always aligns right.
I tried all distribution settings in the stackView already.
For future reference … when you post a "layout" image, it is very helpful to expand the complete hierarchy, including all of the constraints.
I’m assuming your horizontal stack view’s Trailing is constrained to the Trailing of the Content View. That tells auto-layout to keep the stack view the *full width of the content view.
To keep your "bubbles" left-aligned in the Horizontal Stack View, set Distribution: Fill, then constrain its Trailing to be less than or equal to the Content View’s Trailing.
Assuming you used the "standard" way of setting constraints in IB – where the Content View Trailing is constrained to the Stack View Trailing, it’s "reversed" and should be greater than or equal.
So, your constraints probably look very close to this:
2
Answers
For future reference … when you post a "layout" image, it is very helpful to expand the complete hierarchy, including all of the constraints.
I’m assuming your horizontal stack view’s Trailing is constrained to the Trailing of the
Content View
. That tells auto-layout to keep the stack view the *full width of the content view.To keep your "bubbles" left-aligned in the Horizontal Stack View, set
Distribution: Fill
, then constrain its Trailing to be less than or equal to the Content View’s Trailing.Assuming you used the "standard" way of setting constraints in IB – where the Content View Trailing is constrained to the Stack View Trailing, it’s "reversed" and should be greater than or equal.
So, your constraints probably look very close to this:
and should be changed to this:
In code you can always do: