0
votes

I want to scroll ViewControllers vertically. in my app there are 4-5 ViewController is there which i want to scroll vertically. i have added UIStackView inside scrollview and give a try but it is not scrolling properly. i want to scroll like paging in scrollview but vertically.

i have also visited the link https://mecid.github.io/2019/02/27/building-complex-screens-with-child-viewcontrollers/ but i was not helpful.

1
Create a collectionview and add child viewcontrollers in each cell - RajeshKumar R
Show us what have you tried so far. - AjinkyaSharma
I agree you should use a collectionview here - J. Doe

1 Answers

2
votes

You can't scroll the stackView directly, but you can contain it inside a scrollView and then it will scroll. If you look at the tutorial linked, that's exactly what they did:

view.addSubview(scrollView)
scrollView.addSubview(stackView)