I am developing an iphone app and I was wondering the following:
How do I initialise an NSMutableArray of NSMutableArrays to a certain size?
Sorry for the noob question
NSMutableArray *array = [[NSMutableArray alloc] initWithCapacity:5];
for (int i = 0; i < 5; i++) {
NSMutableArray *innerArray = [[NSMutableArray alloc] initWithCapacity:5];
[array addObject:innerArray];
}
You don't set a maximum size. You just keep addObject:'ing to them
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