I have been trying to achieve this design for like 3 days but everything I tried failed.
Here's how my layout is.
I also used this video as a reference on how to implement a UIScrollView since this was my first time ever. https://www.youtube.com/watch?v=VE6DQGy4iS8
I'm not allowed to use UIStackView bec we're targeting iOS 8.
The 2 obvious issues I have right now are:
Okay I managed to do it at the end.
What I did is I pinned the UIView that has the dynamic UILabels to the top, right and left. For its height, I control dragged from it onto the last item inside itself, which is the 2nd dynamic height UILabel in the photo. I control dragged and set the UIView and chose "Bottom Spacing to Container" with the UILabel that has a dynamic height. That way the UILabel controls the UIView's final height which was needed by the UIScrollView to figure out its own height.
Of coarse each UILabel element was pinned top right left only which allows them to be all dynamic.
What you do with the following UIViews (whether you want to give them a static height or dynamic) is your choice.
As for the UIButton at the bottom, I did the same thing with it. I control dragged from the containing UIView (which is nested inside the UIScrollView and contains everything here), to the UIButton and I chose "Bottom Spacing to Container" and set it to 5. This will allow the containing view to adjust its height depending on where the UIButton is located which depends on how much distance it moves when the dynamic labels push their view's height and in turn push the UIButton if that makes any sense.
In short, in a typical scenario you usually pin the last element in the view to the containing view's bottom left and right. However to allow for dynamic changes, you reverse the constraint's 2 items.
I hope this was useful.