Reputation: 2287
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.
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);
}
}
Upvotes: 2
Views: 2391
Reputation: 2287
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!
Upvotes: 1