Add UIScrollView to ViewController

Posted by
  1. Create a Swift Project using Single view template.
  2. Add a ViewController to the Storyboard.
  3. Add ScrollView to the ViewController with Constraints set 0 for top, left, bottom and right. Leave space for the status bar at the top.scrollview
  4. Add a View on top of the Scroll View. Set height of the say to 1000 and the constraints as shown.                        viewuponscroller
  5. Control drag from inner View to the main View as shown below and select equal widths.                                                                          equal widths
  6. Select the ViewController and set the simulated size to freeform.freeform
  7. Set the height of the ViewController to 1000 same as set for the inner view.freeform height

You can then adjust your components over the UIScrollView normally using auto-layout.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.