Matt Vukas Matt Vukas - 1 month ago 5
Objective-C Question

Cannot select Custom Class for Table View Controller (UITableViewController)

Let me preface this by saying that I've already tried quitting and restarting Xcode, as well as deleting derived data for the project, to no avail. I'm at wits end right now.

Basically, I've created a custom

ViewController
class I want to use, but I cannot select it. In fact, using the Custom Class dropdown, I can only select the default
UITableViewController
class for my controller. The weird part is, it looks like the full list appears for a split second sometimes, before being replaced by the incorrect list with a single option. Here's what it looks like:

Trying to select my class in the Identity Inspector Interface Builder

I would really appreciate any ideas here. I'm not really sure what I could have done wrong, since I was following this Apple tutorial pretty much to the T.

For another scene in my project, which is just a plain view controller, I can select custom classes with no problems.

Ideas?

Answer

You have to inherit from UITableViewController class so basically the interface file (.h) should looks like that:

@interface YOURCLASSNAME : UITableViewController

Make sure you replace YOURCLASSNAME with your class name and you add UITableViewController and that should do the job.