简体   繁体   中英

Subview within the scrollview doesn't expand when contentsize increases

So I have a view hierarchy as:

UIView > UIScrollView > ContainerView

I have updated the contentSize of the scrollview and that scrolls fine. However, the ContainerView is limited to the original size of the ScrollView and that has made the areas after scroll non clickable.

See image attached. The ContainerView is in yellow color. 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

I've tried fixing it with heightConstraint to no avail.

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()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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