PDA

View Full Version : Can't sublcass a UITableViewController? Error:"didn't get a UITableView"




mamcx
Jan 27, 2009, 07:24 PM
I have 4 UITableView that share a lot of common functionality.

After build the first, I decide to put the common work in a superclass, then derive from it:

@interface ListController : UITableViewController
<UITableViewDelegate,UITableViewDataSource, UISearchBarDelegate> {

@interface CustomerListViewController : ListController{

And I left everything else as before. But when try to run it I get:

* Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UITableViewController loadView] loaded the "CustomerList" nib but didn't get a UITableView.

This is not a suported scenario?



caveman_uk
Jan 28, 2009, 08:20 AM
The problem is that your nib doesn't have a tableview in it or at least it's not linked to the tableView outlet in the class.

mamcx
Jan 28, 2009, 08:58 AM
Nope, I found my mistake: The superclass is a UITableViewController but the nib expext a UIViewController. I have search bar so can't be a direct descendant of UITableViewController.

And tahnk you. I forget connect the table too ;)

tomsoderlund
Jul 26, 2009, 09:07 AM
I have search bar so can't be a direct descendant of UITableViewController.

Actually, it can, but the UITableView must be the root view in Interface Builder. Check Apple's TableSearch example: https://developer.apple.com/IPhone/library/samplecode/TableSearch/

Tom.