objective c - Add Objects from one Array to Another at a Specific Position -
i have 2 mutable arrays, firstarray , secondarray. both populated objects. want add objects secondarray firstarray @ specific point (not @ end , not @ beginning) in firstarray. there way this? i'm using line of code:
[self.firstarray addobjectsfromarray:secondarray];
what want foo code: self.firstarray addobjectfromarray @ specific point x: secondarray,specificpointx)
any appreciated!
answering own question, works:
int z; z = (int)self.specificposition; // start adding @ index position z , secondarray has count items nsrange range = nsmakerange(z, [secondarray count]); nsindexset *indexset = [nsindexset indexsetwithindexesinrange:range]; [self.firstarray insertobjects:secondarray atindexes:indexset];
Comments
Post a Comment