0
我有一个存储在核心数据view1中的开支及其价格列表。 我在view2中检索这些值,并在tableView中显示它们。更新核心数据中的值
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
//Displayin the values in a Cell.
NSManagedObject *records = nil;
records = [self.listOfExpenses objectAtIndex:indexPath.row];
self.firstLabel.text = [records valueForKey:@"category"];
NSString *dateString = [NSString stringWithFormat:@"%@",[records valueForKey:@"date"]];
NSString *dateWithInitialFormat = dateString;
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc]init];
[dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss Z"];
NSDate *date = [dateFormatter dateFromString:dateWithInitialFormat];
[dateFormatter setDateStyle:NSDateFormatterMediumStyle];
NSString *dateWithNewFormat = [dateFormatter stringFromDate:date];
self.secondLabel.text = dateWithNewFormat;
[dateFormatter release];
NSString *amountString = [NSString stringWithFormat:@"%@",[records valueForKey:@"amount"]];
self.thirdLabel.text = amountString;
}
,如果我对TableView中连续单击它应该导航到VIEW1,我应该能够编辑在核心data.Can任何一个可以告诉我如何做到这一点的价值和更新?
您可能会使用'didSelectRowAtIndexPath' – Dustin 2012-08-01 13:32:19
我知道如何导航,但我不知道如何更新值。 – 2012-08-01 13:33:19
'[nameOfManagedObjectContext save:&error]' – Dustin 2012-08-01 13:34:57