![](/img/trans.png)
[英]scrollView doesn't work even though contentSize is larger than frame and subview is added before setting content size
[英]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.