2

I'm trying to have a UIStackView in a UIScrollView with changing content in the UIStackView as shown below in the image. How ever I don't manage to get it to work properly. When I launch my app it does not scroll and only 10 items are shown in the stack view, not the 20 I expected. Also it does not scroll all the way down of the UIStackView.

Note it's important that this can work on both iPhone and iPad even when rotated.

Scene

I have the following code in my View Controller (that's all):

@IBOutlet weak var stackView: UIStackView!

override func viewDidLoad() {
    super.viewDidLoad()

    for i in 1 ... 20 {
        let vw = UILabel()
        vw.text = "Holiday #\(i)"
        stackView.addArrangedSubview(vw);
    }
}
Bjarte
  • 2,167
  • 5
  • 27
  • 37

1 Answers1

1

I found a solution using this as a foundation: https://github.com/oliverfoggin/AnimalBrowser

The code remains the same, but I changed around a bit on the scene and now it works!

Scene

Bjarte
  • 2,167
  • 5
  • 27
  • 37
  • Thanks for sharing, altho the project you shared didn't directly fixed my issue it helped me get guidance with a more complex issue that I am facing. – Helmut Granda Feb 20 '16 at 06:59