How can I add multiple objects to my NSArray? Each object will have the same value.
Ex.
I want the value "SO" added to my array 10 times
You can initialize the array with a set of objects:
NSString * blah = @"SO";
NSArray * items = [NSArray arrayWithObjects: blah, blah, nil];
or you can use a mutable array and add the objects later:
NSMutableArray * mutableItems = [[NSMutableArray new] autorelease];
for (int i = 0; i < 10; i++)
[mutableItems addObject:blah];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With