I'm creating a basic form with various fields. I'd like to use UIStackView
to layout all the controls. How would I do the following so the controls are aligned correctly? Is the UIStackView
the correct way to do this?
A streamlined interface for laying out a collection of views in either a column or a row.
A layout where the stack view aligns the center of its arranged views with its center along its axis. case leading. A layout for vertical stacks where the stack view aligns the leading edge of its arranged views along its leading edge.
UISV-spacing constraints simply add the same spacing between each of the subsequent subviews. The spacing is defined by the value of the stack view spacing property.
Apple suggests creating horizontal stack views with each label and field, and then putting them in a vertical stack view.
This makes sense in that if you later change one of controls to a different control (say a popup button), you can keep the label and control baselines aligned.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With