UIScrollView height while adding content programmatically in UIStackView

Viewed 1845

I am trying to make a view containing an UIScrollView. This UIScrollView contains 3 UIViews. The last one contains another UIStackView I wanted to fill at runtime.

Here an image of the storyboard :

Storyboard

enter image description here

But when I add content at runtime in the second UIStackView, the ScrollView's height remains the same.

The second UIStackView is defined as the first one with:

  • Axis : vertical
  • Alignment : Fill
  • Distribution : Equal Spacing

Then I use :

mStackView.addArrangedSubview(matProgress)

The result below :

enter image description here

What's the way to have the bottom view and the ScrollView stretch to fit the content.

2 Answers
Related