What are gray constraints in Xcode view hierarchy debug view?

匿名 (未验证) 提交于 2019-12-03 08:39:56

问题:

I know what the solid ones are: I created them myself. What about the gray ones? Implicit, maybe via size-to-fit? The gray height conflicts with the solid height. Where do the gray ones come from?

回答1:

You are inspecting an object such as a label that has an intrinsic content size. The intrinsic content size generates height and width constraints; that's what intrinsic content size is. The constraints in gray are showing you the constraints that the intrinsic content size generates. If you just look at them, you can see that: they say "content size"!

They are in gray because they are overridden by your explicit constraints (they have a lower priority). But they are still there, and if you were not overriding them, they would take effect (and they would not be gray).



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