So I\'m using a UIScrollView in a view controller in the latest Xcode. I have buttons inside the scroll view. When I run the application, the scroll view disapp
Here's a recipe for setting up a scroll view with Auto Layout.
Drag out a scrollView and add it to your ViewController. Pin its edges to the edges of its superView.
Drag out a new UIView and drop it into your scrollView. This will serve as the contentView for the scrollView and it is the only top level view in the scrollView. Pin all four of its edges to the edges of the scrollView. Note: this will not set the content size of the scrollView.
If you want the scrollView to scroll vertically only, set the width of the contentView to the width of the scrollView. To do this, go to the Document Outline View and control-drag from the contentView to the scrollView and select Equal Widths from the pop up.
To set the height of the content view, you can set a height constraint and then change its height to the value you want. The value needs to be larger than the height of the scrollView if you want it to scroll. The other way to do it is to make sure that all of the items in your contentView all have height constraints and are all pinned to each other, and the topmost one is pinned to the top of the contentView and the bottom one is pinned to the bottom of the contentView. If you do this, then Auto Layout will be able to compute the height of the contentView for you. If this total height is greater than the height of the scrollView, then your contentView will scroll.
Finally, add in your button. You can now center the button horizontally in the contentView since you established the width of the contentView in step 3.