Reputation: 9419
I have two labels and one image view (the "sound" image) in a stack view. Actually, the top label and image view are in a horizontal stack view which is inside another vertical stack view.
I want the "test" label to be as close to the image view as possible, however, as you can see in the image the "test" label stretches out as much as it can so that the "test" + image view width matches the width of the label below. How can I fix this?
I know I could use some fake transparent view in the top horizontal stack view to push the image view as close as possible to the test label but I'd rather avid hacks.
Upvotes: 0
Views: 133
Reputation: 13281
That should be pretty easy.
Interface builder:
Result:
Settings:
Give your test UILabel
a height if you want to make it good, or equal to the button or imageView, but as I can see in your screenshot, you already did what specifically what you wanted to do, except the settings of your vertical (main) UIStackView
.
Play with your stackView settings. In my vertical (main) stackView, my Alignment
is set to Leading. Setting it to the default Fill will achieve the unwanted result like in your screenshot. Distribution is up to you.
I hope this helps! :)
Upvotes: 1