objective c - ObjectiveC, creating array of classes -
i have class contains values:
@interface params : nsobject { [...] nsstring *fc; nsstring *sp; nsstring *x; nsstring *y; [...] @property (nonatomic, assign) nsstring *fc; @property (nonatomic, assign) nsstring *sp; @property (nonatomic, assign) nsstring *x; @property (nonatomic, assign) nsstring *y; [...] @end
it's possible create in objective-c array of classes? c# / java?
myclass[] = new myclass[20] ??? a[0].fc = "asd" ?
or equivalent?
thanks, alberto
while standard way nsarray
, can c-style array well:
int numobjects = 42; params ** params = malloc(sizeof(param*) * numobjects); (int = 0; < numobjects; ++i) { params[i] = [[[params alloc] init] autorelease]; } free(params);
however, using nsarray
simpler. :)
Comments
Post a Comment