Helmut Granda
Helmut Granda

Reputation: 4665

UIStackView inside UIScrollView position

I have a ScrollView that starts at a Y position of 50, inside the ScrollView I have a StackView with dynamic elements added. The elements are added and the scroll works as expected. However the StackView is drawn at Y=0 so that the first element is against 0,0 of the application while the ScrollView is at 0,50.

I have tried several things from assigning constraints, to changing the frame.origin.y position and frame.offsetInPlace.

Are there any recommendations out there? It all is being done dynamically with SWIFT and without a xib.

Upvotes: 1

Views: 741

Answers (1)

Helmut Granda
Helmut Granda

Reputation: 4665

You can find an example of scrollView with stackView here:

UIStackView - Distribute views evenly from the centre

Thanks Hamza Ghazouani for the tip.

Upvotes: 1

Related Questions