BVReorderTableView icon indicating copy to clipboard operation
BVReorderTableView copied to clipboard

Core Data compatible

Open Sun3 opened this issue 10 years ago • 2 comments

I am trying to using the wonderful control with a UITableViewController bound to a Core Data source but one I release the drag the row always goes back immediately to original position?

Is this control compatible with Core Data, is there possible sample code?

Thank you

Sun3 avatar Apr 15 '14 19:04 Sun3

BVReorderTableView is totally compatible with Core Data. I'm using them together in my app ThenDo (free). When you say your UITableViewController is "bound do a Core Data source" do you mean you're using NSFetchedResultsController?

You need to remember that if you're reordering your items by dragging them around, you'll also have to change whatever attribute of your object Core Data is using to order them, which may mean changing the order attribute of more than just the item you moved. It's not difficult, but you need to think about it.

mluisbrown avatar Apr 16 '14 13:04 mluisbrown

@mluisbrown Yes, I am using NSFetchedResultsController The example project is using NSArray in the delegates and I am trying to figure out what to use since my data is not from an array.

For example what would I use below if I am using core data?

- (id)saveObjectAndInsertBlankRowAtIndexPath:(NSIndexPath *)indexPath {  
    id object = [_objects objectAtIndex:indexPath.row];
    [_objects replaceObjectAtIndex:indexPath.row withObject:@"DUMMY"];
    return object;
}

Any help is appreciated :)

Thanks.

Sun3 avatar Apr 17 '14 05:04 Sun3