4

I have two labels inside a UIStackView with a 10 pixels spacing as a default value and a 0pixel spacing for my compact layout.

stackview interface builder

This works fine on Ipad, the spacing is of 10pixels between the two UILabels. The issue is on iPhone (compact width). The spacing is not actually 0 pixels but still 10 pixels. When debugging the view hierarchy, we can clearly see the constraint added by autolayout with a spacing of 10 pixels when the value is supposed to be zero.

iPhone 8 compact layout - zero spacing

If I update the compact value from 0 to 0.1, the spacing is properly set to zero.

iPhone 8 compact layout - non-zero spacing

The issue is presents in xcode 10.0 beta, ios 12.0 but also xcode 9.4 ios 11.4. Any idea why that's happening?

wheeliez
  • 1,568
  • 1
  • 10
  • 14
  • It doesn't *seem* like it should matter, but... If you set `Spacing: 0` and add a variation of `wR Spacing: 10` you will get Zero spacing on `wC` and 10 spacing on `wR`. – DonMag Jul 09 '18 at 17:55

0 Answers0