Graham Perks
Graham Perks

Reputation: 23390

Xcode view hierarchy debugger - "prototyping"

What does the word "prototyping" mean in the view debugger? It's used to describe a constraint that I didn't add. In IB, the view in question (the upper-left onion image) has an intrinsic width, and its right edge is anchored. It shouldn't need any extra horizontal constraints.

In IB I was designing with a view having simulated metrics set to "Freeform" size, the debugger is showing the view on a 6S. I'm guessing the answer lies in the difference between the two, but can't fathom what's going on.

The added "prototyping" constraint is pulling the onion out of place, towards the left screen edge. Why was it added?

enter image description here

Upvotes: 2

Views: 107

Answers (1)

Jon Brooks
Jon Brooks

Reputation: 2492

The 'prototyping' constraints are added by XCode Interface Builder when you don't supply enough constraints for it to determine what the layout should be. If you plan to add constraints later at runtime, which it sounds like you're doing, you can add constraints in IB and set them to be removed at build time.

Just add a constraint for the view's leading edge to superview (even though you don't want it), select the constraint in IB, and check Remove at build time.

IB image

Upvotes: 2

Related Questions