如何为嵌入另一个堆栈视图的堆栈视图设置顶部布局约束?

时间:2015-10-30 21:08:45

标签: ios storyboard uistackview

Image

我想在5px标签和give视图顶部之间设置GiveLabelStack的垂直间距。当我使用布局约束设置它时,我得到一个错误;见下文。堆栈视图会自动添加give.top = GiveLabelStack.top的约束。另外,我无法选择删除和​​删除约束。

Can't delete the constraint

在此图片上,我无法选择要删除的give.top = GiveLabelStack.top

有谁可以实现这个目标?

由于

1 个答案:

答案 0 :(得分:1)

Put the label inside its own vertical stack view (which is inside the horizontal GiveLabelStack). Set the vertical stack view's top layout margin to 5.

Before:

before extra stack

After:

after extra stack

Here's where you set the stack view's layout margins:

setting the layout margins