Thank you for taking the time to look at this post,
I have in one project i have a UIViewController called DemoTableViewController Defined like this:
Code:
@interface DemoTableViewController : UIViewController <UITableViewDelegate, UITableViewDataSource>
with an outlet, so when the data gets updated I just call "reloadData" on this.
Code:
IBOutlet UITableView *theTable;
Then in the NIB i hook up:
- Files Owner to the UIView
- Set the class of File's Owner to be DemoTableViewController
- Add a Table View to the view, hook up the Delegate/Datasource to File's Owner
- Hook up the "theTable" outlet to point to the TableView.
This works perfectly.
I have used UIViewController instead of UITableViewController because i don't want the table to take up the whole screen as i would like to add a toolbar.
However if I try the SAME exact thing on an app that has a navigation controller, adding the view like this:
Code:
DetailViewController *detailView = [[UIViewController alloc] initWithNibName:@"DetailViewController" bundle:nil];
detailView.title = [self.list objectAtIndex:row];
self.myDetailView = detailView;
AlexNavAppDelegate *delegate = [[UIApplication sharedApplication] delegate];
UINavigationController *navController = [delegate navigationController];
[navController pushViewController:self.myDetailView animated:YES];
I get an error like:
Code:
2009-06-30 07:57:18.666 AlexNav[7027:20b] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIViewController 0x550c70> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key theTable.'
If i "unhook" the outlet "theTable" then i get on gdb:
Code:
009-06-30 08:25:23.227 AlexNav[7109:20b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[UIViewController tableView:numberOfRowsInSection:]: unrecognized selector sent to instance 0x550a10'
I just dont know what to do, I've read everything i can, and search (really searched) this forums and i can find an answer. This
post has something similar but they are using UITabBarController which has multiple UIViewControllers which all separately have their own NIB file assigned. And this is not the case.
It seems to me that even though im pointing the datasource/delegate for the table in the NIB, it is not looking there for them.
Any ideas are welcome, I don't know where to look anymore
Greetings,
Alex