user2363025
user2363025

Reputation: 6505

scrollView not scrolling swift

I have a scroll view which is not scrolling. Googling seems to indicate that it may be to do with my constraints?

My constraints are as follows:

Trailing space to superview  = -16
Leading space to superview = -16
Top space to top layout guide = 0
Bottom space to bottom layout guide = -13

I am printing out the scrollview contentSize in the viewDidLayoutSubViews and it is printing out the same value each time i.e:

scrollview is (375.0, 356.5)

Any idea what the issue may be

Upvotes: 0

Views: 9241

Answers (1)

Alaeddine
Alaeddine

Reputation: 6212

Check the bottom constraints of the content view (container inside ScrollView) in your case it's the UILabel

Apple Technical Note TN2154: UIScrollView And Autolayout

To size the scroll view’s frame with Auto Layout, constraints must either be explicit regarding the width and height of the scroll view, or the edges of the scroll view must be tied to views outside of its subtree.

Useful article : Using UIScrollView with Auto Layout in iOS

Upvotes: 2

Related Questions