0

I have nested Stack Views and I am trying to set margins for the inner most Stack View but I'm getting Conflicting Constraints. I am trying to set the inside Stack View to 30 pixels from the top of the container Stack View and the conflict I get looks like this:

Stack View.top = top + 30
top = Stack View.top

I've read through the Apple documentation on setting margins and do not see which setting to use to avoid the conflict. The hint only narrows down the issue to a "constant, relation, or priority of one of the given constraints." I am looking for a solution using the Interface Builder or in Swift.

1 Answers1

0

SOLVED: I found an answer in a related question (How to add leading padding to view added inside an UIStackView) that solved my problem, but I'm not sure this is the right way to do it. By changing the inner Stack View's Layout Margins from "Default" to "Fixed", the margins can be set without a Constraint Conflict.

To change the Layout Margin from Default to Fixed inside the Interface Builder, click on the Stack View > Size Inspector > Layout Margins > Fixed and then a new set of options will appear for you to add the margin values.

Fixed layout options image