Unable to make outlet connection to a constraint in IB

johnnyspo picture johnnyspo · Feb 28, 2014 · Viewed 21k times · Source

I am running XCode 5 with iOS 7. I need to dynamically change the height constraint of a UITextView prior to its layout. I have seen many postings stating that this can be done by making an outlet connection from the constraint in IB to the source code. I am trying to make the connection from the constraint outlet in IB to the header file of the owning class, but am unable to make the connection - IB does not "highlight" when I drag over the header file, as it does when making connections from other objects like buttons etc.

Has anyone encountered this before? All help is greatly appreciated.

Answer

matt picture matt · Mar 1, 2014

Here is a picture of me doing it. I'm control-dragging from the constraint to the header file.

enter image description here

In real life I'm more likely to control-drag to the anonymous category in the implementation file, because I don't want an IBOutlet property to be public. So here's a picture of that too. Sorry, this screen shot does not show the cursor: it is at the bottom end of the stretch line.

enter image description here