Unable to Set Referencing Outlet

vfvfvfvfvfvfvfvfv picture vfvfvfvfvfvfvfvfv · Nov 18, 2014 · Viewed 14.4k times · Source

I am unable to set a referencing outlet for a text field I have created. I am trying to do this via Ctrl-Drag. Can anyone advise? I have set the delegate as the View Controller. In general, I only have one view which is populated with a few text fields and I have written the following code for the ViewController.h which is what I'm trying to set up as a Referencing Outlet:

@property (weak, nonatomic) IBOutlet UITextField *userIDText;

Answer

nhgrif picture nhgrif · Nov 18, 2014

First, make sure the control you're dragging from is the same class as the outlet (in this case, UITextField) or it could be a subclass of that class.

Second, make sure control's parent view is a subclass of the file you're dragging to.

Third, make sure the file you're dragging to is saved. This is the most common problem I run into. Go to the source file you're dragging to and push Cmd+S to save.

Fourth, when in doubt, Cmd+Shift+K to clean, Cmd+B to build, then try again. If that still doesn't work, restart Xcode. And if it's still not working, go back through the checklist.