0

No code because everything is placed in xib.

Structure: UIScrollView contains UIView (UIScrollView Scrollable Content Size Ambiguity) which contains UIStackView which contains a list of subviews. All the UIStackView subviews have fixed height except of one which has "minimal height" only and I need to stretch this view to make UIStackView fullfilling all available height if necessary. If UIStackView is very big then UIScrollView should scroll UIStackView.

Tried a lot of combinations but the only view which should stretch or collapse has unpredictable height. In better case it works as expected but UIScrollView content fully ignores safe area (becomes larger than expected).

Did somebody faced this problem?

Edited

It is a view controller inside xib, loading/presenting modally. A link to xib

Gargo
  • 1,135
  • 1
  • 10
  • 21
  • If you are sure your changes have "fixed" your issue, great. But, if you're looking for *maybe a better solution* we need more information. Is your `xib` a *view controller*? or a *view*? How are you loading/displaying it? Show us a screen-cap of your layout, making sure to expand all of the constraints so we can see what you're doing. – DonMag Aug 10 '23 at 12:40
  • @DonMag edited question and even added an original xib (where problem wasn't solved) – Gargo Aug 11 '23 at 06:34

1 Answers1

0

Found a weird solution:

  • disable safe area for the root view
  • enable safe area for scroll view (which is is inserted directly in the root view)
  • setup constraints like here (leading, trailing, top, bottom, equal width, equal height with low priority) with one difference - scroll view's root view height should be equal not to superview height but to safe area height

But maybe someone can suggest a better solution

Gargo
  • 1,135
  • 1
  • 10
  • 21