簡體   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