scrollView not scrolling swift

∥☆過路亽.° 提交于 2019-12-12 05:52:05

问题


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


回答1:


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



来源:https://stackoverflow.com/questions/31379654/scrollview-not-scrolling-swift

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!