iosuiscrollviewuistackviewsafearea

UIScrollView with UIStackView which resizes to fullfill the screen height


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


Solution

  • Found a weird solution:

    But maybe someone can suggest a better solution