I have tried everything I can to get the alignment of the UIStackview contents to be .centred or .trailing or anything other than the .leading alignment.
It does not work, and beginning to become frustrating.
I'm now wondering if this is a bug or if i'm doing something silly.
I would appreciate any help or pointers to get this working, thanks.
.
.
.
I have created a sample project adapted from one of the Xamarin samples located here: https://github.com/kooldave98/StackViewIssues
I've fixed this issue now: an extra equal width constraint between the scrollView and the stackView.
scrollView.addConstraints(NSLayoutConstraint.constraintsWithVisualFormat("H:[stackView(==scrollView)]", options: .AlignAllCenterX, metrics: nil, views: ["stackView": stackView, "scrollView": scrollView]))
Answers
Update: Here's a more simplified and complete UIViewController that demonstrates this issue:
The buttons never get centered !!!
I've fixed this issue now: an extra equal width constraint between the scrollView and the stackView.