- (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;
}
運行時:自定義的UITableViewCell NSUnknownKeyException
NSArray *nib=[[NSBundle mainBundle] loadNibNamed:@"TodoTableViewCellController" owner:self options:nil];
,並有一個例外: *終止應用程序由於未捕獲的異常 'NSUnknownKeyException',原因:「[setValue方法:forUndefinedKey:]:這類不是關鍵日期的關鍵值編碼。「
我不知道爲什麼會發生,所以請幫助我,謝謝!
[此類不是密鑰的密鑰值編碼兼容密鑰]的可能重複(http://stackoverflow.com/questions/3088059/this-class-is-not-key-value-coding-compliant -for-the-key) – jtbandes 2015-08-01 19:18:02