Add spacing constraint to superview in Xcode 5 Add spacing constraint to superview in Xcode 5 xcode xcode

Add spacing constraint to superview in Xcode 5


To add a constraint between a view and its' superview (like "bottom space to superview") you can use the Document Outline (The left part of the Interface Builder).

In the Document Outline:

  1. Hold the ctrl-key and drag from the view to its' superview (or vice versa).
  2. Select the constraints you want to add (in this example "Bottom Space to Container").

ctrl-drag from the view to its' superview (or vice versa)Select the constraints you want to add


The answer By Jarig is good but can sometimes lead to unexpected results as noted in the comments.

Another option is to select the child view and go to:

Editor > Pin > Top Space to Superview

or whichever constraint you want.


Seems to be a bottom edge constraint now.Select your view and its superview, tap on "Align" and check the "Bottom edges" thingy

pic