3
votes

hoping someone can point me in the right direction here.

I have a layout I'm trying to build with a vertical stackview. Stackview is pinned at the left, top and right edges of view at 0. I have a horizontal stackview inside which has 3 images all 30x30 that I want left aligned. (Not spaced out across horizontal stack.)

XCode continues to give me conflicting constraints errors here. I believe its because it wants my stackview to be at 100% of outer vertical stack view width. I can add in a random view that stretches and it fixes the problem, but this seems VERY clunky.

What's the best approach for this?

1
Did you set the Alignment property of the Vertical StackView to Leading? - DonMag
@DonMag - Good idea! I just set it to leading for vertical stack view. Unfortunately it did not resolve my auto-layout errors. - James Scott
@DonMag - Correction, I may have made a mistake... I think you have solved this for me! Crossing my fingers here... - James Scott
Can you post a screen shot? As far as I can tell, this is what you were after, and I get no auto layout warnings or errors (I used labels instead of image views, but that would have no effect)... imgur.com/a/DBCO4 - DonMag
God Bless you @DonMag - Shunan

1 Answers

3
votes

So, @DonMag has answered my question - The vertical stack view should be leading which will not force every horizontal stack view inside to expand to its width. Thanks @DonMag!