So, I'm trying to connect the tableView component to a UIViewController created through the .xib user interface. I get the classic -[UIView tableView:numberOfRowsInSection:]: unrecognized selector sent to instance 0x1f544cb0 and guess that I have connected something incorrectly or am doing something that I should not do with the interface builder. I searched google and stack overflow and found similar questions, but not with answers that helped my situation. I hit my head trying to figure it out and hope someone here can help. I only did this through a storyboard or with .xib when the controller was a UITableViewController. I usually just use the UITableViewController, but I may need to add a toolbar at the bottom of the view so that this option is not viable. Here are the steps I took to create the class, please let me know if I am doing something wrong.
First I create a XIB file for the user interface: 
Then I add the table view component in XIB: 
In LeftMenuViewController.h, I add the following line of code to tell the class to use UITableViewDelegate and UITableViewDataSource:
@interface LeftMenuViewController : UIViewController <UITableViewDataSource, UITableViewDelegate>
Then I connect the table view component with the delegate and data source, dragging the control from the component to the File Owner header and selecting the delegate and data source, as you can see:

Then I add the following lines of code to LeftMenuViewController.m to provide definitions for the necessary TableView delegate methods:
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return 5; } - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { return 48; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell; return cell; }
This process causes the application to throw an NSInvalidArgumentException that throws an error [UIViewController tableView:numberOfRowsInSection:]: unrecognized selector . What am I doing wrong? Everything I tried or recommended did not work.
source share