less than 1 minute read

Implementing a UIScrollView is really easy when you know/do three fundamental things. There is a video I uploaded that walks you through this process UIScrollView Video but in case you forget you can use the following as a reference.

  1. Use a View (let’s call it, ContentView) in your ScrollView to keep the layout of your buttons easier. But putting all your controls in your ContentView which is inside your ScrollView, you will make everything much easier.

Silvrback blog image

  1. Your ContentView needs to have constraints to your ScrollView. These constraints will not change the size of your ContentView but will be used by the ScrollView to calculate the boundaries of your ContentView. Apple has purposely repurposed this constraint so that you can do this in the Storyboard.

Silvrback blog image

  1. Your ContentView can’t depend on the ScrollView for the size (partially because of point #2). But it could use constraints on the highest level View or but using its own content.