1

Putting an UILabel and an UIButton to an UIStackView causes a bigger spacing, than is really necessary. I need the info button to be directly next to the label. Setting constraints or hugging priorities didn't help.

It looks like this. Distribution of the StackView is Equal Spacing. Other UI Elements don't cause this behavior and are positioned directly next to the label.

Wrong spacing

How can I achieve the same UIStackView without spacing? I saw this problem already several times, but could not find any solution to it.

Simon C.
  • 1,605
  • 14
  • 13

1 Answers1

0

Give the stackView , top , leading/trailing and a height constraint and make it's distribution = fill you'll get this

enter image description here

//

enter image description here

Also you can omit the height constraint if you want it also intrinsic like width

Shehata Gamal
  • 98,760
  • 8
  • 65
  • 87