It is a simple pull to refresh case. I have data loaded into table and have a mutable data array at back-end, I receive a array of new data and want to add this complete array a
First, build an NSIndexSet
.
NSIndexSet *indexes = [NSIndexSet indexSetWithIndexesInRange:
NSMakeRange(0,[newArray count])];
Now, make use of NSMutableArray
's insertObjects:atIndexes:
.
[oldArray insertObjects:newArray atIndexes:indexes];
Alternatively, there's this approach:
oldArray = [[newArray arrayByAddingObjectsFromArray:oldArray] mutableCopy];