I am trying to make a scrollable stack view inside a scrollview but it doesn't work.
I have built a structure like this:
If you can't see the image, this is the structure:
UIScrollView constrained to superview in all 4 directions
UIStackView (constrained to scrollview in all 4 directions + equal width)
Image Collection View (not constrained)
UIStackView (not constrained)
Stack of Labels (not constrained)
It doesn't scroll, can anyone see what I am missing?
You should set ContentView
in your ScrollView
with constraints like:
ScrollView's Constraints:
Bottom to superView
These constraint's constants are 0
ContentView's Constraints:
Bottom to superView
Equal height to ViewController's View
(which is in the top of the view hierarchy)
Equal width to ViewController's View
Note: You should set ContentView's height constraint's priority to 700 etc. (lower than default high value)
Attention:
Your stackViews and collectionView must have height for scrollable.
I hope it is works.
Enjoy.