[英]How to use Freeform Simulated Size to change height of scrollView but not width
I am using the Freeform
simulated size to change the View Controller
height so I can arrange all subviews in a scrollview
. 我正在使用
Freeform
模拟的大小来更改View Controller
高度,以便可以在scrollview
安排所有子视图。
UIView
called bodyView
to the ScrollView
to be the container of the body content and set all margins to the scroll view. bodyView
的UIView
添加到ScrollView
中,作为主体内容的容器,并将所有边距设置为滚动视图。 Add another UIView
to be the header with a fixed height of 400 but set the rest of the margins to the BodyView
to stay at the top and to be the same width. 添加另一个
UIView
作为具有固定高度400的标头,但将其余的页边距设置为BodyView
以保留在顶部并保持相同的宽度。
UIImagevView
to the headerView
and set all constraints to the header UIImagevView
添加到headerView
并将所有约束设置为header This is how it looks so far: 到目前为止是这样的:
However once the UIViewController
is run on smaller device sizes the scroll view retains the original width of 414 and the content does not fit in the frame; 但是,一旦
UIViewController
在较小的设备尺寸上运行,滚动视图将保留原始宽度414,并且内容不适合框架。 even though there is no width constraint set for neither of the sub views. 即使没有为两个子视图都设置宽度限制。
Does anybody know where I am going wrong and what might be happening ? 有谁知道我要去哪里错了,可能会发生什么?
I have been researching and even checked out other projects and cannot seem to replicate/resolve the issue. 我一直在研究,甚至签出其他项目,似乎无法复制/解决问题。
bodyView必须从外部scrollview获得其宽度,因此,将Control从bodyView拖动到viewController的视图并选择Equal- Widths-高度是根据从上到下的钩子元素计算的
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.