1
votes

I'm trying to wrap my head around how UIScrollViews work and while there are already some pretty good answers, they don't seem to cover UITextViews, so I was wondering if anyone could tell me more about what UITextViews require to work in a UIScrollView. My setup looks like the image below and I'm getting errors that the ScrollView has no height or width constraints.

If you could, I'd appreciate it if you could elaborate a little on why this doesn't work and what requirements TextViews have when placed inside ScrollViews.

enter image description here enter image description here enter image description here

1
Hi can you share this storyboard with us, it would be easier to detect what actually is wrong, but for a start try to remove "Scrolling Enabled" checkmark from UITextView in Attributes InspectorAndrew
Hey @Andrew isScrollable is disabled on the textviews. You can see the full storyboard here: dropbox.com/s/g7q1lbj0pxx14jh/Main.storyboard?dl=0CristianMoisei

1 Answers

1
votes

So https://www.dropbox.com/s/gujry7ngziaipm7/Main.storyboard?dl=0 here is the fixed variant. I found a few errors:

  1. Top constraint from Title Input was to view from another hierarchy

  2. Content View - your root view in UIScrollView was without x, y constraints, so I added trailing, bottom, top and leading constraint.

And maybe some tips:

  • Your constraint should be relative to each other, so you have no need to offset all views from Safe Layout.

  • Try to separate your viewControllers to different Storyboard files, otherwise if you would work in team, it would be a real headache to fix merge problems in git)

Hope it will helps you in your project)