scrollView 不快速滚动 [英] scrollView not scrolling swift

查看:28
本文介绍了scrollView 不快速滚动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个不滚动的滚动视图.谷歌搜索似乎表明这可能与我的限制有关?

我的约束如下:

超视图的尾随空间 = -16超视图前导空间 = -16顶部空间到顶部布局指南 = 0底部空间到底部布局指南 = -13

我在 viewDidLayoutSubViews 中打印出滚动视图 contentSize 并且每次打印出相同的值,即:

scrollview 是 (375.0, 356.5)

不知道是什么问题

解决方案

检查内容视图的底部约束(ScrollView 内的容器)在你的情况下它是 UILabel

Apple 技术说明 TN2154:UIScrollView 和自动布局<块引用>

要使用自动布局调整滚动视图框架的大小,约束必须要么明确滚动视图的宽度和高度,或者滚动视图的边缘必须绑定到其外部的视图子树.

有用的文章:在 iOS 中使用带有自动布局的 UIScrollView

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

解决方案

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

这篇关于scrollView 不快速滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆