Reputation: 2279
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.
Upvotes: 1
Views: 43
Reputation: 471
So https://www.dropbox.com/s/gujry7ngziaipm7/Main.storyboard?dl=0 here is the fixed variant. I found a few errors:
Top constraint from Title Input
was to view from another hierarchy
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)
Upvotes: 1