I am facing following Exceptions while creating the custom cell.
*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<MasterTableView 0xb612b30> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key address.'
The delegate function i am using is as follows:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
NSArray *top=[[NSBundle mainBundle]loadNibNamed:@"CustomCell" owner:self options:nil];// on this line program received SIGABRT
for (id current in top) {
if ([current isKindOfClass:[UITableViewCell class]]) {
cell=(CustomCell *)current;
break;
}
}
}
// Configure the cell...
cell.name.text=@"name";
cell.address.text=@"Address";
return cell;
}
Besides this i have done the following steps:
- i have given File owner of the
CustomCell.xibtoMasterTableView.h - i have given outlet of the custom cell to
MasterTableView.h - i have given outlets for the two
UILabels toCustomCell.h - I have given
Cellas Cell Identifier in IB
I have shared the whole project in Dropbox, available in the below stated link. You can check that one also. I want to know what wrong in it..
Please show me the missing steps..
Thank you in advance.
PS :- I have used CoreData in my project. Without core data this steps have given me the correct desired Output but not in this project. I have checked with default cells. It worked fine.
I compiled and ran the code in a sample project, and it worked with no problems at all. Make sure you have everything connected in Interface builder as previously mentioned!
Edit:
You have the IBOutlets connected twice in Interface Builder, I attached images for your reference. They should not be connected to the File’s Owners, remove the connection from File’s Owner.
You also will notice the rows are not the right size, you must specify the row size in the table view.