I found two good solutions in StackOverflow:
1 2 |
[existingArray replaceObjectsInRange:NSMakeRange(0,0) withObjectsFromArray:newArray]; |
And the second one:
1 2 |
NSIndexSet *indexes = [NSIndexSet indexSetWithIndexesInRange: (NSRange) {0, [newArray count]}]; [existingArray insertObjects: newArray atIndexes: indexes]; |