Custom UITableViewCell NSUnknownKeyException

- (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *TodoListTableIdentifier = @"TodoListTableIdentifier";
    TodoTableViewCellController *cell = (TodoTableViewCellController *)[tableView dequeueReusableCellWithIdentifier:TodoListTableIdentifier];
    if ( cell == nil ) 
    {
        NSArray *nib=[[NSBundle mainBundle] loadNibNamed:@"TodoTableViewCellController" owner:self options:nil];
        cell=[nib objectAtIndex:0];
        [cell setSelectionStyle:UITableViewCellSelectionStyleGray];  
    }
    Todo *todo = [self.allTodoArray objectAtIndex:[indexPath row]];


    cell.titleLabel.text = todo.fileTitle;
    cell.money.text = [NSString stringWithFormat:@"Monei:%f",todo.amount];
    cell.name.text = todo.realName;
    cell.date.text = todo.operateTime;

    return cell;
 }

at startup:

 NSArray *nib=[[NSBundle mainBundle] loadNibNamed:@"TodoTableViewCellController" owner:self options:nil];

and there is an exception: * Application termination due to an unmapped exception "NSUnknownKeyException", reason: "[setValue: forUndefinedKey:]: this class does not match the keywords for the key date. '

I don’t know why this happens, so please help me with this, thanks in advance!

+5
source share
3 answers

The error means that you connected something to the output called the date at your tip, but this outlet does not exist. Where do you announce the date?

+15
source

Plug in all your outlets in the TododTableViewController XIB (especially the outlet) and run again.

+2
source
  • Custom Class UITableViewCell.
  • Install Custom Classcells in your table class cell class myCustomCell.
  • Get out of UIlabelc myCustomCell.h.
+1
source

All Articles