Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to Set Referencing Outlet

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;
like image 741
vfvfvfvfvfvfvfvfv Avatar asked Nov 18 '14 22:11

vfvfvfvfvfvfvfvfv


3 Answers

In my case, to be able to create a referencing outlet,

  1. I had to open the Storyboard.
  2. Click on the top View Controller element (left panel in the Storyboard)
  3. In the Identity Inspector (right panel), I had to select from the list my custom view controller class before I could drag and create the referencing outlet in it.
like image 142
oabarca Avatar answered Oct 13 '22 10:10

oabarca


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.

like image 14
nhgrif Avatar answered Oct 13 '22 10:10

nhgrif


In my cace,(swift3) 1.right click on the storyboard. 2.Ctrl-Drag from black window and ReferencingOutlet to View on the storyboard. enter image description here

like image 1
Hideyasu.T Avatar answered Oct 13 '22 11:10

Hideyasu.T