-2

I need to layout my labels like this: enter image description here

But i'm getting this layout: enter image description here

If I add spaces between two labels, then they all move out:

Here's view hierarchy: enter image description here

Alexander
  • 163
  • 8

3 Answers3

1

Name three labels “left”, “centre” and “right” for understanding purpose for now.

Put all three labels inside Horizontal Stack View

Set StackView both settings to “Fill”

Now let’s fix labels

  • left label

    • content hugging priority - Horizontal : 1000
    • Aspect ratio - 1:1
    • Text Alignment - Centre
  • right label

    • content hugging priority - Horizontal : 1000
Bista
  • 7,869
  • 3
  • 27
  • 55
0

You can set the Distribution property of UIStackView to Fill Equally on the Attributes Inspector tab on the right side. And modify the text alignment of the leading label to leading and the trailing label to trailing.

Frankenstein
  • 15,732
  • 4
  • 22
  • 47
0

Solved my problem by putting label into the view container.

Alexander
  • 163
  • 8