How do I create multiple instances of an identical object and call them in an array in an efficient manner?
I am aware of for-loops, but am not familiar with Objective-C syntax. This is what I currently have:
ViewController.h
NSArray *wArray;
NSInteger w0, w1, w2, w3, w4, w5, w6, w7 , w8, w9, w10, w11, w12, w13, w14, w15, w16, w17, w18, w19, w20, w21, w22, w23, w24, w25, w26, w27, w28;
@property NSArray *wArray;
@property NSInteger w0, w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11, w12, w13, w14, w15, w16, w17, w18, w19, w20, w21, w22, w23, w24, w25, w26, w27, w28;
@end
ViewController.m
@synthesize w0, w1, w2, w3, w4, w5, w6, w7 , w8, w9, w10, w11, w12, w13, w14, w15, w16, w17, w18, w19, w20, w21, w22, w23, w24, w25, w26, w27, w28, wArray;
wArray = [NSArray arrayWithObjects: w0, w1, w2, w3, w4, w5, w6, w7 , w8, w9, w10, w11, w12, w13, w14, w15, w16, w17, w18, w19, w20, w21, w22, w23, w24, w25, w26, w27, w28, nil];
Thanks in advance!
Create a NSMutableArray and use:
And if you want to store integers you can use:
You can then access these objects by: