Bigfoot11
Bigfoot11

Reputation: 921

How does one utilize a UIScrollView.?

I have created a UIScrollView in my VieController. I have a bunch of UILabels that fill up the entire screen from the top to the bottom of the UISrollView (the UIScrollView extends below the ViewController). I am unsure how to utilize the UIScrollView and how I would code it to scroll down when the user does.

Any input would be greatly appreciated.

Thanks in advance.

Upvotes: 0

Views: 37

Answers (1)

Victor Sigler
Victor Sigler

Reputation: 23451

I strongly recommend you see this excellent tutorial :

How To Use UIScrollView to Scroll and Zoom Content in Swift

You have to set the contentSize of the ScrollView or handle it's size by constraints inside of it.

Set the contentSize in the following way :

scrollView.contentSize = CGSize(width: 768, height: 2000)

Then you can scroll horizontally and vertically with the above example.

Upvotes: 1

Related Questions