You have many UIView
s in your stackView
and a UIView
does not have any intrinsic height so there is ambiguity.
The stackView
basically does not know what height to set for the inner uiview
elements and consequently at what y position they will start.
Solution #1:
- Select the topmost
stackView
that contains all your other stackView
s and in it's Attributes Inspector, change it's distribution to Fill Proportionally
.
- Give X & Y position for the back button

Solution #2:
- You give a height constraint to each
UIView
(your backButtonView
, titleView
, etc.) except for the last one bottomSpace

Besides, you have nested stackView
s unnecessarily. Also, you don't have to do everything in a stackView
.
The first view looks like you want a top bar with a back button. You should be using a navigationBar
with a navigationItem
which need not and should not be in a stackView
unless your design has a special requirement.
The last view looks like you want to leave space so you have a bottomSpace
view in a stackView
and both of these are unnecessary.
Solution #3
- Redesign your layout and simplify it further.
For your layout, you can make do with a single stackView
btw.
As an example, it's not exactly as per your design but near about:
