• Home
  • About
  • Our Apps
  • Learn
  • Contact
Login

Register

Login
Seemu Apps Seemu Apps
  • Home
  • About
  • Our Apps
  • Learn
  • Contact

How to add a Simple Scroll View in the Storyboard to your App

Home ios How to add a Simple Scroll View in the Storyboard to your App

How to add a Simple Scroll View in the Storyboard to your App

Jan 31, 2017 | Posted by Andrew | ios, swift, tutorial, xcode |

This tutorial will cover adding a simple Scroll View in the Storyboard to your app. We will be showing vertical scrolling, but it can easily be adapted to scroll vertically as well.

First of all, create a new single view application and open up the storyboard. Drag a UIScrollView onto the storybord as follows:

Then set the constraints as follows (Select the red lines for the spacing to nearest neighbour)

With this done, select the View Controller. Then at the top right show the size inspector. Then change the simulated size to Freeform, and set the height to 1000. This will give us space to place objects on the scroll view in the storyboard, and allow it to scroll.

Next up we place the two labels on the scroll view so we can test that it actually works:

Next up select the scroll view, we need to connect it up to our view controller to add one line of code to allow it to scroll! Select the assistant editor in the top right, and hold the control key and drag the line to the ViewController.swift. Now drop it and create an outlet called myScroll, it will add the following:

@IBOutlet var myScroll: UIScrollView!

Next add the following line of code to viewDidLoad()

myScroll.contentSize = CGSize(width: self.view.frame.width, height: 1000)

The content size sets how far in each direction you can scroll. We set ours to the width of the current device, and the height to 1000, which if you recall is the height we set the View Controller in the storyboard. Now if you run your app you can see it scrolling as follows:

 

 

 

Tags: scollviewscrolluiscrolluiscrollview
0
Share

About Andrew

Andrew is a 24 year old from Sydney. He loves developing iOS apps and has done so for two years.

You also might be interested in

Page View Controller Tutorial With Page Dots

Feb 3, 2017

This post will cover setting up a UIPageViewController in Swift,[...]

Welcome

Hi I am Andrew and welcome to Seemu Apps! Have a look around, we provide tutorials for primarily iOS apps.
Bluehost website hosting discount

Seemu’s Studio Setup

Blue Yeti Microphone
Rode Stand
Spider Shock Mount
Mac Keyboard Cover
Screenflow - recording software

Contact Us

We're currently offline. Send us an email and we'll get back to you, asap.

Send Message

Footer

:)

© 2026 · Your Website. Theme by HB-Themes.

  • Home
  • About
  • Our Apps
  • Learn
  • Contact
Prev Next