Reputation: 3255
I created the following layout:
The label on the right side, is included in a stackview, but is "clinging" to the right side of the screen when launching the app. I want to achieve some spacing, but don't know how to achieve it.
The expected output would look like this:
Upvotes: 3
Views: 2521
Reputation: 1092
When isLayoutMarginsRelativeArrangement
property is true, the stack view will layout its arranged views relative to its layout margins. So here,
stackView.layoutMargins = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 20)
stackView.isLayoutMarginsRelativeArrangement = true
The above will add 20 pixels width of padding to the right edge of the stackview. This can also be done via the storyboard.
Upvotes: 2