after teaching myself (mostly website) have been unable find solution problem.
trying create 1 million nsmutablearrays unique names. mean not having 'hard code' of individual arrays.
this:
for (int = 1; <= 1000000; i++) { nsstring *arraynumber = [nsstring stringwithformat:@"%d", i]; nsstring *millionarraynumber = @"millionarraynumber"; nsstring *arrayname = [millionarraynumber stringbyappendingstring:arraynumber]; nsmutablearray *[nsstring arrayname] = [nsmutablearray array]; }
i can understand why doesn't work can't think of way of doing it. thought might possible use similar to:
[button settag = 1];
if change code to:
for (int = 1; <= 1000000; i++) { nsmutablearray *millionarray = [nsmutablearray array]; [millionarray settag: i]; }
i use tag control arrays can buttons. doesn't work arrays though.
hope haven't been ambiguous.
i'm not sure how convert string literal code you're doing, think it's possible.
however, can kick 1 million arrays nsmutabledictionary , give each 1 unique key name.
nsmutabledictionary *arraystore = [nsmutabledictionary dictionary]; (int = 1; <= 1000000; i++) { nsstring *arraynumber = [nsstring stringwithformat:@"%d", i]; nsstring *millionarraynumber = @"millionarraynumber"; nsstring *arrayname = [millionarraynumber stringbyappendingstring:arraynumber]; arraystore[arrayname] = [nsmutablearray array]; }
and whatever array want later, use:
nsmutablearray *uniquearray = arraystore[arrayname];
edit: not sure if want keep number unique key mentioned in comment below if so, can this:
nsmutabledictionary *arraystore = [nsmutabledictionary dictionary]; (int = 1; <= 1000000; i++) { arraystore[@(i)] = [nsmutablearray array]; }
and access (for example, array number 100):
nsmutablearray *uniquearray = arraystore[@100];
Comments
Post a Comment