[英]Scrollview is not scrolling using autolayout though I have added proper constraints
I have got a layout in following form 我有以下格式的布局
I have got the views in following hierarchies. 我对以下层次结构有意见。
---View
-------TopView
---------Label
--Scrollview
---------ContentView
----Buton
The content view has got the constraing attributes as in the following picture, 内容视图具有令人信服的属性,如下图所示,
The problem is that scrollview is not getting scrolled. 问题是scrollview没有滚动。 Am i missing any layout constraints from being set?
我是否错过了设置的布局限制? scroll view is of width 374 and height 534. Contentview is of width 334 and height 494
滚动视图的宽度为374,高度为534。Contentview的宽度为334,高度为494
Every time you try to add the scroll view on something like submit application/ form then remember these steps: 每次您尝试在诸如提交申请/表格之类的内容上添加滚动视图时,请记住以下步骤:
On base view add a scroll view with frame exactly equal to base view 在基础视图上添加滚动视图,其框架与基础视图完全相同
add top left bottom and right constrain (should be 0 each) 添加顶部,左侧,底部和右侧约束(每个应为0)
Have you set ScrollView contentSize ? 您设置了ScrollView contentSize吗?
Please check you have set scrollable height. 请检查您是否设置了可滚动的高度。
Eg. 例如。
scrlVIewSignUp.contentSize = CGSizeMake(self.view.frame.width, 1000)
Where 1000 is the approximate height.(please set height as per your requirement) 大约高度为1000(请根据您的要求设置高度)
I assume you are running into issues with the contentSize. 我假设您遇到了contentSize问题。 Check out this .it is about how to handle the contentSize when using a "pure" AutoLayout approach.
看看这个 .it关于使用“纯”自动布局方法时如何处理contentSize。 The gist of it is that your constraints implicitly define the content size.
其要点是您的约束隐式定义了内容大小。 You NEVER set it explicitly when using AutoLayout.
使用AutoLayout时,您永远不要显式设置它。
it also have, attached example project at the end of the blog post to demonstrate how it works. 它还在博客文章的末尾附加了示例项目,以演示其工作原理。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.