Why all the element moved when adding a constraint in storyboard?

若如初见. 提交于 2019-12-11 14:05:51

问题


I design all my element nicely for a prototype cell of tableView,but whenever I add a new constraint for my element,all element just moved and become like image below:

It happen often,may I know why is this happen and how to prevent it?

EDIT :

For example,before adding constraint it look like this

The white part in the center is a stack view,so I set it to leading = 0 and trailing=0.And then I add a constraint inside the stack view to leading=0 which it align with the stackview all element moved again and become like this:

As you can see,all thing just disappear.Why is this happen ya??

The constrainst that I adding is like below:

Status Label.leading = leading

It happen also when I set the spacing of the stackview to 10,all the element also gone.

Edit:

I have a red arrow appear in storyboard,I suggest the Content Priority Ambiguous,but I after change the priority as to 252 as suggested,all element just disappear again.


回答1:


Remove the bottom constraint of the bottom most element attached to the content view and add all your remaining constraints & with stackView spacing , then re add the bottom constraint again



来源:https://stackoverflow.com/questions/48140066/why-all-the-element-moved-when-adding-a-constraint-in-storyboard

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!