Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

loaded the "PersonnalDetails" nib but didn't get a UITableView

Tags:

iphone

I am trying to load a new view with the following code

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

 PersonnelDetails *detailViewController = [[PersonnelDetails alloc] initWithNibName:@"PersonnelDetails" bundle:[NSBundle mainBundle]];

[self.navigationController pushViewController:detailViewController animated:YES]; [detailViewController release];

} inhertance :- PersonnelDetails inherits UITableViewController

but i am getting an exception : Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UITableViewController loadView] loaded the "PersonnalDetails" nib but didn't get a UITableView.' even though i have a UITableView in the PersonnalDetails nib and also i have connected the view outlet of PersonnelDetails(viewController) to the UITableView. what can be the posible cause?

like image 243
awsome Avatar asked Nov 29 '22 19:11

awsome


2 Answers

I think the problem is because you are subclassing UITableViewController instead of UIViewController. I had same problem before.

like image 172
Tùng Đỗ Avatar answered Dec 09 '22 17:12

Tùng Đỗ


This might sound strange, but in my case I really needed a UITableViewController with a table view. I am not using xib files, so I'm building all interface using code.

I was receiving the same error.

What I did was to override the loadView method just like this, and it worked!

- (void)loadView {
    [super loadView];
}

What's stranger now is that if I comment the loadView method I receive another error:

this class is not key value coding-compliant for the key settingsView

, while the settingsView property I'm not using it and it's commented.

I'm confused now! Though with the loadView override it works.

Edit

I've deleted the app from my iPhone then run it again with loadView commented and it works now...

like image 21
Bogdan Avatar answered Dec 09 '22 16:12

Bogdan