vfvfvfvfvfvfvfvfv
vfvfvfvfvfvfvfvfv

Reputation: 163

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;

Upvotes: 14

Views: 17500

Answers (3)

Hideyasu.T
Hideyasu.T

Reputation: 875

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

Upvotes: 1

dev4life
dev4life

Reputation: 11394

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.

Upvotes: 8

nhgrif
nhgrif

Reputation: 62072

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.

Upvotes: 15

Related Questions