2

I put three vertical stack views to a horizontal stack view. Although the distribution of the horizontal stack view is set to Equal Spacing, the second vertical stack view is aligned to left on a simulator(The first one is aligned to left and the third one is aligned to right). Would there be any reasons that it is not allocated to center?

The constraints of the views are below:

  1. The horizontal stack view is aligned to center of its superview.
  2. The horizontal stack view's top space is 20 from its superview's top.
  3. The horizontal stack view's bottom space is 20 from its superview's bottom.
  4. The horizontal stack view's width is 450.
  5. The vertical stack views' width is 130.

Xcode Version: 10.1

Please let me know if there is any lacked information.

1 Answers1

1

[Make sure you have options selected as in image and put spacing as required(30 was in my case)and make sure the alignment of components inside the vertical stack view are center aligned eg: text aligment for label should be centre aligned. check image][1]

TacosLayer
  • 41
  • 3
  • Although I tried to set the horizontal stack view's distribution to Fill Equally as in the image, it occurs some layout issue. So I have set it to Equal Spacing. It works on the storyboard though not on a simulator. – Counterclockwise Feb 12 '19 at 14:16