I know how to insert objects into a table using...
[self.tableView insertRowsAtIndexPaths:array withRowAnimation:UITableViewRowAnimationAutomatic];
And how to reload/delete/move rows using the corresponding methods.
So, my question...
I have an array @[@"apple", @"banana", @"pear", @"strawberry"]
that is already in the table and I download some new data in the form of this array...
@[@"orange", @"raspberry"]
How should I insert these into the table so that the order remains?
In the end I want this...
@[@"apple", @"banana", @"orange", @"pear", @"raspberry", @"strawberry"]
So, I can't just merge and sort the arrays as I'd lose the indices of where things have been inserted.
I don't want to just merge and reload data as you lose the animations.
If for instance I iterate the array and do...
//begin updates
//insert object @"orange" at index 2
//insert object @"raspberry" at index 4
//end update
then are the adjusted indices taken in to consideration? i.e. if I add them the other way around then @"raspberry" would be added at index 3 not 4. Does the table view work with this adjustment on the fly?