【发布时间】:2014-03-12 15:00:46
【问题描述】:
我找不到如何从我的表视图中删除核心数据实体实例。
这就是我使用来自核心数据的信息更新表格视图的方式:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
Datos * record = [self.fetchedRecordsArray objectAtIndex:indexPath.row];
cell.textLabel.text = [NSString stringWithFormat:@"%@ ",record.punto];
UIImage* image = [UIImage imageWithData:record.imagen];
cell.imageView.image = image;
return cell;
}
我正在尝试使用以下函数来删除实体实例,但它不起作用:
-(void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationAutomatic];
}
【问题讨论】:
-
为什么不使用 NSFetchedResultsController??
标签: ios objective-c uitableview core-data