I have a view with 3 dynamic labels inside it and I am trying to find a way to centre it vertically in a scroll view but when its dynamic labels are too large to fit on a pa
I've faced the same issue while trying to vertically center a label inside a scrollView when the label does not fill the scrollView (top aligned otherwise) and found an as simple solution as it is dirty, all in IB with no extension or sub-classing.
First of all, set the usual contraints when dealing with a UIScrollView:
Then make the child view's height greater or equal to the scrollView height (it triggers a constraint error). Now set this constraint multiplier to anything close to 1 but not quite (eg. 0.999999). The constraint error disappears and the child view behaves as expected.
Not proud of this one but it could save some time to people in a rush.