scrollView 不滚动 swift
scrollView not scrolling swift
我有一个不滚动的滚动视图。谷歌搜索似乎表明这可能与我的约束有关?
我的约束如下:
Trailing space to superview = -16
Leading space to superview = -16
Top space to top layout guide = 0
Bottom space to bottom layout guide = -13
我在 viewDidLayoutSubViews 中打印出滚动视图 contentSize,并且每次都打印出相同的值,即:
scrollview is (375.0, 356.5)
知道问题出在哪里
检查内容视图的底部约束(ScrollView
内的容器)在你的情况下它是 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.
我有一个不滚动的滚动视图。谷歌搜索似乎表明这可能与我的约束有关?
我的约束如下:
Trailing space to superview = -16
Leading space to superview = -16
Top space to top layout guide = 0
Bottom space to bottom layout guide = -13
我在 viewDidLayoutSubViews 中打印出滚动视图 contentSize,并且每次都打印出相同的值,即:
scrollview is (375.0, 356.5)
知道问题出在哪里
检查内容视图的底部约束(ScrollView
内的容器)在你的情况下它是 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.