why elements don't have equal sizes?

I have a Vertical Stack View on my screen (Alignment = Fill, Distribution = Fill).

In it there are from top to bottom:

  1. Label (no constraints)
  2. Vertical Stack View (height=21)
  3. Horizontal Slider (height=21)
  4. Label (no constraints)

I was expecting that both my labels (elements 1 &4) will be of equal size and will occupy the majority of the screen and 2nd & 4th elements therefore would be in the center of the screen. But in reality my bottom Label's height is sufficient only to fill it's text while my top Label takes the majority of the space.

I tried to change the Distribution of my Stack View to Fill Proportionally, but in that case my top label becomes smaller than the bottom one.

Why is it happening? How can I make my Labels to become of equal height?

PS I noticed a warning about Content Priority Ambiguity but I can't figure out what should I do about it

Answered by anils in 694861022
  • Set horizontal hugging priority for 60 to 252 as suggested
  • Add a equal height constraint between EDIT TIMER DURATION and ANOTHER LABEL
  • Set vertical hugging priority for Duration to 1000
  • Set vertical hugging priority for Horizontal Slider to 1000

Accepted Answer
  • Set horizontal hugging priority for 60 to 252 as suggested
  • Add a equal height constraint between EDIT TIMER DURATION and ANOTHER LABEL
  • Set vertical hugging priority for Duration to 1000
  • Set vertical hugging priority for Horizontal Slider to 1000

why elements don't have equal sizes?
 
 
Q