Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

loaded the "ChatView" nib but didn't get a UITableView.'

I have a custom UITableViewController ("ChatView") that has an Output for a tableView. In the interface builder I have connected the tableView in the nib to the outlet. When the view loads I get the above error. The view is loaded via a tabcontroller.

I have done some research about the error and I can't seem to track down the issue. I would appreciate if someone could get me going in the right direction to resolve this.

@interface ChatViewController : UITableViewController
<UITableViewDelegate, UITableViewDataSource> {

    NSMutableArray *chatMessages;
    IBOutlet UITableView *chatTable;
    IBOutlet UITextField *chatText;


}

@property(nonatomic, retain) IBOutlet UITextField *chatText;
@property (nonatomic, retain) IBOutlet  UITableView *chatTable;
@property (nonatomic, retain) NSMutableArray *chatMessages;


-(IBAction)sendPressed;


@end

Thanks

like image 954
Nick Avatar asked Apr 24 '11 19:04

Nick


2 Answers

Had a similar problem. The runtime dump was saying:

loaded nib but didn't get a UITableView

I had hooked up everything fine on the storyboard. I had a viewController as the main class and had a UITableView object with a custom cell inside.

However, the problem was that my custom class had 'somehow' ended up being a UITableView instead of this:

@interface iPadDetailViewController : UIViewController <UITableViewDelegate> {
    IBOutlet UITableView *tableBox;
}

Once I managed to match up the storyboard type with the custom class type it was all fine.

The moral of the story, xCode and the compiler is usually right. Check your classes match.

like image 134
Gerald Avatar answered Sep 22 '22 13:09

Gerald


If your class is a UITableViewController then the view outlet must be connected to the table view. If you want a view that contains a UITableView then simple make the controller a UIViewController which conforms to the UITableViewDelegate and UITableViewDataSource protocols and this will go away.

like image 22
rharter Avatar answered Sep 22 '22 13:09

rharter