I have two arrays and I would like to append one to the end of the other. How can I go about doing this?
self.itemsCopy = [self.items mutableCopy];
Will copy the array, but I would like to append self.items.
I have two arrays and I would like to append one to the end of the other. How can I go about doing this?
self.itemsCopy = [self.items mutableCopy];
Will copy the array, but I would like to append self.items.
Assuming itemsCopy
is an NSMutableArray
that has already been created, you can do:
[self.itemsCopy addObjectsFromArray:self.items];
Check out the docs for NSMutableArray
:
Adds the objects contained in another given array to the end of the receiver’s content.
(This won't be a deep copy, however)