Dynamic ScrollView in Xcode 12

In this post i will explain how to implement a dynamic scrollview using storyboard.

  1. Create new Xcode project.
Scroll View constraints

uncheck / Disable the content layout guides in the size inspector tab.

4. Search for “UIView” in the library , place it inside the scrollview. Set constraint (top, bottom, leading and trailing) as (0,0,0,0).For better understanding, name this view as containerView.

5. Set Container view width = scrollview width and container view height = mainview height . set height priority to 250.Please ensure that the multiplier property is set to one for height and width both .

6. Place a UIView inside container view and give (Top , leading and trailing ) (0,0,0)and height constraint .

now, the important point to keep in mind is you need to provide the bottom constraint of last view for the scrollview to work properly.

so place as many uiviews as you like ,provide constaints and give bottom constraint to the last view w.r.t the container view and you are good to go!

If you have any doubts , i have attached the video of this project below.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store