Add objects to NSArray
suggest changeNSArray *a = @[@1];
a = [a arrayByAddingObject:@2];
a = [a arrayByAddingObjectsFromArray:@[@3, @4, @5]];
These methods are optimized to recreate the new array very efficiently, usually without having to destroy the original array or even allocate more memory.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents