3

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?

James Scott
  • 990
  • 2
  • 10
  • 29
  • 3
    Did you set the Alignment property of the Vertical StackView to `Leading`? – DonMag Apr 21 '17 at 17:21
  • @DonMag - Good idea! I just set it to leading for vertical stack view. Unfortunately it did not resolve my auto-layout errors. – James Scott Apr 21 '17 at 18:33
  • @DonMag - Correction, I may have made a mistake... I think you have solved this for me! Crossing my fingers here... – James Scott Apr 21 '17 at 18:35
  • 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)... https://imgur.com/a/DBCO4 – DonMag Apr 21 '17 at 18:36
  • God Bless you @DonMag – Shunan Oct 28 '20 at 12:33

1 Answers1

3

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!

James Scott
  • 990
  • 2
  • 10
  • 29