我有一个从sql db读取数据的UITableView。 当我重新排序数据时,它只会更改顶部和底部的数据
从上到下拖动1
当我完成退出应用程序并再次打开应用程序时,之前的更改未保存?
图像:
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {
id buffer = [MyObject objectAtIndex:fromIndexPath.row];
[MyObject removeObjectAtIndex:fromIndexPath.row];
[MyObject insertObject:buffer atIndex:toIndexPath.row];
}
- (void)setEditing:(BOOL)editing animated:(BOOL)animated
{
[super setEditing:editing animated:animated];
if (!editing) {
//save here
[self.managedObjectContext save:nil];
}
}