0

So I've followed all the best practices with respect to having a scrollable content view that works with autolayout (first have one direct subview of UIScrollView, add all the pin constraints, etc), especially when you have a UITextView (i.e. disable scrollingEnabled on the text view)

for example here, or just googling UIScrollView and Autolayout you'll find a lot of tutorials that rehash the same thing.

I've done all this, but am noticing that the scrollView is calculating a contentSize that does not match the contentView's height. I have no idea why this is:

enter image description here

I expect moderators to point out other questions. I looked around and nothing really matched what I'm seeing...

horseshoe7
  • 2,745
  • 2
  • 35
  • 49
  • 1
    You say it doesn't match, so... What is the `contentView`'s height? And, is your `contentView`'s bottom anchor constrained to the bottom anchor of the scroll view, with a constant of Zero? – DonMag Jun 12 '19 at 20:46
  • ha! very bizarre. Somehow in the storyboard the constant was set to 680 – horseshoe7 Jun 14 '19 at 19:23

1 Answers1

0

For completeness, it was DonMag's comment that solved it. Unknowingly, the constant was not set to 0, which explains why the contentSize.height WAS 680pt larger than the content.

horseshoe7
  • 2,745
  • 2
  • 35
  • 49