Reputation: 189
I want to add margins or paddings on the right of some nested UILabels
like shown here:
Using trailing spaces on the labels seems wrong and old-school somehow.
Any way to make that more elegant on interface builder?
Upvotes: 12
Views: 13829
Reputation: 386018
Just add a spacer view at the end of the horizontal stack view. Set its color to clear. Give it a width constraint to fix its size.
Or, judging from your screen shot, it looks like you could just move the right edge of the top-level stack view (child of MasterCell) to leave a margin.
You can set layout margins on a stack view, in the Size inspector:
Maybe you just want to set the right layout margin.
If you set the stack view's layout margins in code (the layoutMargins
property), you must also set its layoutMarginsRelativeArrangement
property to YES
.
Upvotes: 34