One UILabel
is placed directly into UIStackView
the second UILabel
is the same but embedded in another UIView
:
I need >=
constraint due to some more complex layout but I simplified the example. The labels should have the same position on the screen and the same width. But even in this example it causes random layout errors.
Tried to change priorities - it doesn't help. How to resolve this issue?
Found a strange solution:
Both labels should have "Content Hugging Priority" 750 (High) and "Content Compression Resistance Priority" 1000 (Required).
If you do it your external stack view will be resized to the widest of 2 labels. And it looks workable even with multiline labels!