简体   繁体   English

当contentsize增加时,scrollview中的子视图不会展开

[英]Subview within the scrollview doesn't expand when contentsize increases

So I have a view hierarchy as: 所以我有一个视图层次结构为:

UIView > UIScrollView > ContainerView UIView> UIScrollView>容器视图

I have updated the contentSize of the scrollview and that scrolls fine. 我已经更新了scrollview的contentSize,并且滚动良好。 However, the ContainerView is limited to the original size of the ScrollView and that has made the areas after scroll non clickable. 但是,ContainerView限于ScrollView的原始大小,这使得滚动后的区域不可单击。

See image attached. 参见附件。 The ContainerView is in yellow color. ContainerView为黄色。 As you can see, the view is scrolled well but the touches after Select Province is denied. 如您所见,视图滚动良好,但是选择省份后的触摸被拒绝。 I can't touch elements like Select City, Zipcode 我无法触摸选择城市,邮政编码等元素

How do I increase the ContainerView's height OR allow the touches beyond visible area 如何增加ContainerView的高度或允许触摸超出可见区域

I've tried fixing it with heightConstraint to no avail. 我尝试用heightConstraint修复它无济于事。

profileScrollView.contentSize = CGSize(width: profileScrollView.frame.width, height: lastView.frame.origin.y + lastView.frame.size.height)

containerViewHeightConstraint.constant = profileScrollView.contentSize.height

在此处输入图片说明

Try This 尝试这个

profileScrollView.contentSize = CGSize(width: profileScrollView.frame.width, height: lastView.frame.origin.y + lastView.frame.size.height)

containerViewHeightConstraint.constant = profileScrollView.contentSize.height

self.view.layoutIfNeeded()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM