This is my setup: I have an UIScrollView
with leading,top, trialing edge set to 0. Inside this I add an UIStackView
with this constraints:
stackView.centerYAnchor.constraintEqualToAnchor(selectedContactsScrollView.centerYAnchor).active = true
stackView.leadingAnchor.constraintEqualToAnchor(selectedContactsScrollView.leadingAnchor).active = true
Inside the stack view I add some views.
My issue is that because of the constraints the first view added to stack view will also have leading edge = 0.
What are the ways that I could add some padding to the first view ? Without adjusting the scroll view constraints.
Best Answer
When
isLayoutMarginsRelativeArrangement
property is true, the stack view will layout its arranged views relative to its layout margins.But it affects all arranged views inside to the stack view. If you want this padding for only one arranged view, you need to use nested
UIStackView