我正在尝试找到一个代码示例,该示例显示如何处理 tableView 中的移动/重新排列单元格。
为了删除核心数据,我使用下面编写的代码
- (void)tableView:(UITableView *)aTableView commitEditingStyle: (UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
if (editingStyle == UITableViewCellEditingStyleDelete)
{
NSFetchRequest* fetchRequest = [[NSFetchRequest alloc] init];
NSEntityDescription* entityDescription = [NSEntityDescription entityForName:@"MyBase"
inManagedObjectContext:self.objectContext];
[fetchRequest setEntity:entityDescription];
NSArray *empArray=[self.objectContext executeFetchRequest:fetchRequest error:nil];
if ([empArray count] > 0){
Moneybox *employee = [empArray objectAtIndex:indexPath.row];
[self.objectContext deleteObject:employee];
[self.objectContext save:nil];
}
[self buscarContactoExistente];
[myTable reloadData];
}
}
我该怎么做
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath
风格相同?