Re: Two Dimensional NSArrays
Re: Two Dimensional NSArrays
- Subject: Re: Two Dimensional NSArrays
- From: Ondra Cada <email@hidden>
- Date: Sat, 22 Sep 2001 23:33:40 +0200
John,
>
>>>>> John Stringham (JS) wrote at Sat, 22 Sep 2001 16:34:04 -0400:
JS> MyObject arrayOfMyObjects[10][10];
...
JS> That said, my questions are as follows: If I were to use an NSArray, is
JS> there a simple/elegant way to create a two dimensional array?
Use an array of arrays:
// fill
NSMutableArray *a=[NSMutableArray array];
NSMutableArray *internal;
for (...) {
[a addObject:internal=[NSMutableArray array];
...
[internal addObject:...];
...
}
// use
NSLog(@"value [%d,%d]=%@",i,j,[[a objectAtIndex:i] objectAtIndex:j]);
---
Ondra Cada
OCSoftware: email@hidden
http://www.ocs.cz
private email@hidden
http://www.ocs.cz/oc