Xcode 10, Swift 5 (this should be doable purely in the Storyboard)
The current layout:
- ChildView (child View of very first default view)
- ButtonView
- ScrollView
- VerticalStackView
- Button
- Button
- ...
- FooterView
- HorizontalStackView
- Button A
- Button B
What contraints do I need to always keep the Footer View at the bottom and make the UIStackView
scroll behind it, while still maintaining a fixed height for each button in the UIStackView
?
This setup seems to attract multiple problems, from the buttons inside not being clickable (or UITextField
s that can't be interacted with), to the UIScrollView
not being scrollable or a "Content Size Ambiguity" error (described here) - just because a single constraint isn't set properly.
The result:
If there are less buttons that can all be displayed at the same time, it won't be scrollable but instead simply display the black background below the last button.
How to get there:
The constraints are set using the "add new constraints" button below the preview window.
ChildView:
1. FooterView:
2. ButtonView:
2.1. ScrollView (black):
2.1.1. VerticalStackView:
2.1.1.1. Button (gray):
Of course you can also replace the buttons in the 'UIScrollView' with views to create some type of form.