Reputation: 242
I'm new to iOS development and Xcode and am trying to learn. First off, I know there are many posts on this very thing and I would not post unless I was desperate. I have quadruple checked all my constraints after reading many posts, videos and articles. I cannot get my scrollview to scroll. I have included all relevant screenshots but if you need more information I can provide. I am doing all this via storyboard rather than programmatically and would prefer to continue in this manner. Please excuse the repeated horizontal constraints in image 4. They are just a repeat and not duplicate constraints. Thank you!
Upvotes: 1
Views: 95
Reputation: 216
To implement a scroll view is very easy here are the steps:
set up a stackView or regular view and input everything you want to be inside that view/stackview (buttons, labels, etc...) -> this is called your "Contentview"
Click on your ContentView and hit "embed in scroll view"
Now ctrl-drag the ContentView to the Content-Layout-Guide and hit
"top", "leading", "trailing", & "bottom space to content layout guide"
It should be working, if it looks weird, click on the Content-Layout-Guide and go to the size inspector. then make sure that all the constraints are set to 0
@seanPatterson also you have have the view as "freeform", you want it to be "inferred"
Upvotes: 1