If you’re using a TableViewController, your class must inherit from a UITableViewController
. Thats when it will show up in the Identity Inspector, which is where you change your class from UIViewController
to your class. After that you should be able to connect IBOutlets.
To do that, just replace your current line
@interface ViewController : UIViewController <UITableViewDelegate, UITableViewDataSource>
with
@interface ViewController : UITableViewController
Now, you will need to add the init method that calls the super, to the .m file.
- (id)initWithStyle:(UITableViewStyle)style
{
self = [super initWithStyle:style];
if (self) {
// Custom initialization
}
return self;
}
I hope this will do it.
Also, sometimes, changes in the code don’t show up in the storyboard Identity Inspector. In that case, you can just quit the Xcode window and open the project again. That does it.
Alternatively, if you use a ViewController, your class can inherit from a UIViewController
. Then you add a TableView to your View and add a UITableView instance to the controller file (create an IBOutlet). In this case, your .h file needs to add the UITableViewDelegate
and UITableViewDataSource
to populate the table and your .m file needs to implement the required methods (Xcode will warn you about this).