Question

I've searched for a few hours to try and figure out the answer, but haven't as of yet. On creating an outlet/action for an iOS app in Xcode 5:

I'm trying to create an outlet (by CTRL-dragging) from a label in Main.storyboard to ViewController.h (which I had to manually select in the Assistant Editor because only UIViewController.h shows up under "automatic")

No "outlet/connection/action" menu shows up when I drag. However, a menu does show up if I try to drag to the UIViewController.h file. (It just then tells me UIViewController.h is locked, and I can't unlock it)

I've also tried putting "ViewController.h" into the custom class part, as that seemed to work for some other askers out there.

I believe it may (?) have something to do with ViewController.h not showing up under "Automatic" in Assistant Editor. I have tried creating an outlet with a different project and that seems to work, and ViewController.h shows up under automatic.

I'd like to have posted a screenshot but I need 10 reputation. Anyway, thanks in advance for your help!

Was it helpful?

Solution

You need to set the Custom Class in the storyboard to a class that you have written that subclasses UIViewController.

OTHER TIPS

Make sure that the scene you are using is under the UIViewController class that you intend on using it with.

Here is how:

  1. Select Scene (click black bar underneath || ctrl+shft+click || Document Oultine)
  2. Select Identity Inspector
  3. Enter UIViewController class of interest under Custom Class
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top