Unable to select custom class for ViewControllers in Xcode Storyboard

garma picture garma · Sep 29, 2013 · Viewed 13.1k times · Source

I just upgraded Xcode to 5.0. I'm still fairly new to cocoa so I hope I'm overlooking something basic. Basically I can't get Xcode to see the custom classes that I want to use as parent classes for view controllers. Originally I wanted to create a custom class for a tableview controller but to simplify the problem I tried it with regular viewcontrollers, but that doesnt work either.

What I do:

  • Create new project: Single View Application
  • Add a cocoa class to it (File->New->File->Objective-C class. I name it MyViewController and make it a subclass of UIViewController
  • I select the default view that comes with the project template in the storyboard, and in the Identity inspector I try to select MyViewController under Custom Class

The class simply does not appear in the drop down, and I cant type it myself either. Many other threats reporting the same problem suggest closing/reopening the project and Xcode but that doesnt work either for me.

Answer

wigging picture wigging · Sep 29, 2013

When you are in the storyboard, Interface Builder of Xcode, make sure you click on black colored bar under the view:

enter image description here

This will select the view controller (not the view) in the storyboard. Notice how the whole scene has a blue border around it. Once this is selected, you can set the class of the view controller in the Identity Inspector.