Trouble with UIScrollView and constraints can be solved with 4 key things. Autolayout does work differently with UIScrollView, so it’s easy to feel like you have have a jumbled heap of constraints that don’t give you what you want.
There are a lot of awful examples and ‘solutions’ out there, but these keys make it straightfoward to create with Interface Builder (or in code), requiring no additional work or tricks:
Your scrollView should have one, and only one subview. For clarity I usually name it ‘Content View’
Bind your Content View to the scrollView on all four sides.
If you are scrolling vertically, make the Content View equal width to the scrollView.
Constrain the bottom of the Content View to the last subview. (Not the other way around)
That’s it! Your UIScrollView is all set up, and content can flex even if you’re changing it after the view appears.