繁体   English   中英

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

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

所以我有一个视图层次结构为:

UIView> UIScrollView>容器视图

我已经更新了scrollview的contentSize,并且滚动良好。 但是,ContainerView限于ScrollView的原始大小,这使得滚动后的区域不可单击。

参见附件。 ContainerView为黄色。 如您所见,视图滚动良好,但是选择省份后的触摸被拒绝。 我无法触摸选择城市,邮政编码等元素

如何增加ContainerView的高度或允许触摸超出可见区域

我尝试用heightConstraint修复它无济于事。

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

containerViewHeightConstraint.constant = profileScrollView.contentSize.height

在此处输入图片说明

尝试这个

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