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