Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are gray constraints in Xcode view hierarchy debug view?

Tags:

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?

screen shot from Xcode

like image 488
Andrew Duncan Avatar asked Jan 21 '15 02:01

Andrew Duncan


People also ask

How do you debug a view hierarchy?

First, launch a project with some interesting UI. Project 13, for example, has enough in there to be interesting. Now run the program as normal, then in Xcode go to the Debug menu and choose View Debugging > Capture View Hierarchy. After a few seconds of thinking, Xcode will show you a screenshot of your app's UI.

What is Nslayoutconstraint in Swift?

The relationship between two user interface objects that must be satisfied by the constraint-based layout system.


1 Answers

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).

like image 102
matt Avatar answered Nov 09 '22 23:11

matt