是否可以从配置单元功能更新实体中的值?如果一个数字大于另一个,我想更改条目属性的值。这是我到目前为止所拥有的,但它使应用程序崩溃并出现错误:
Terminating app due to uncaught exception 'NSUnknownKeyException', reason:
'[<Outgoing 0x7fbcf3141890> setValue:forUndefinedKey:]: the entity Outgoing
is not key value coding-compliant for the key "goingover".'
我的configurecell方法:
- (void)configureCell:(UITableViewCell *)cell atIndexPath:(NSIndexPath *)indexPath {
Outgoing *outgoing = [self.fetchedResultsController objectAtIndexPath:indexPath];
cell.textLabel.text = outgoing.costDescription;
cell.detailTextLabel.text = [NSString stringWithFormat:@"%.2f",[outgoing.amount floatValue]];
if (self.incomingTotal > self.outgoingTotal) {
[outgoing setValue:@"no" forKey:@"goingover"];
}
if ([outgoing.goingOver isEqualToString:@"yes"]) {
cell.backgroundColor = [UIColor redColor];
}else{
cell.backgroundColor = [UIColor lightGrayColor];
}
}