22

I am trying to add layout constraints to my NIB, and i am following the directions apple provides here:

http://developer.apple.com/library/ios/#documentation/ToolsLanguages/Conceptual/Xcode4UserGuide/030-Edit_User_Interfaces/edit_user_interface.html

It says this with regards to adding constraints:

To add a constraint Select the object or objects for which you want to add the constraint.

Choose a constraint from the Editor > Add Constraint menu or an alignment type from the Editor > Alignment menu.

That Add Constraint menu is no where to be found. What gives? How can i add constraints??

Sean Danzeiser
  • 9,141
  • 12
  • 52
  • 90

1 Answers1

38

That documentation is incorrect.

Constraints are added via the buttons in the lower right corner of the Interface Builder workspace in Xcode 4.6:

Xcode 4.6 buttons

The button on the left is for alignment-based constraints, and the middle one (the "I-beam") is for pinning spacing/heights.

In Xcode 5.0, those buttons look a little different, but the features are very similar:

Xcode 5 buttons

Rob
  • 415,655
  • 72
  • 787
  • 1,044
  • It doesn't let me add any constraint from the pop-up menu. Do you know why ? – expert Aug 28 '13 at 00:56
  • 3
    @ruslan You (a) need to have autolayout on; and (b) select the view(s) you want the constraints on, and the relevant constraint options should be enabled. If it's not working, you should post your own question on Stack Overflow, including a screen snapshot (via shift-command-4) of what your IB user interface looks like. – Rob Aug 28 '13 at 01:39