Re: Two dimensional array
Re: Two dimensional array
- Subject: Re: Two dimensional array
- From: Shawn Erickson <email@hidden>
- Date: Thu, 13 Nov 2003 18:18:30 -0800
On Nov 13, 2003, at 4:27 PM, Jay Rimalrick wrote:
What if I wanted to float values like 1.2, 3.4 instead of the arrays?
I can't seem
to get it to work with
NSArray *root;
root = [[NSArray alloc] initWithObjects:
[[NSArray alloc] initWithObjects: 1.1, 2.2, 3.3, 4.4, 5.5, nil],
[[NSArray alloc] initWithObjects: 10.10, 9.9, 8.8, 7.7, 6.6, nil],
...
nil ];
Only objects can be added to NSArray or any of the collection classes,
they depend on the object supporting retain/release/etc.
Replace the float values with [NSNumber numberWithDouble:# the float #].
Of course in the archives I believe someone has a multidimensional
array class that makes things a little easier then trying to do the
above.
Also consider using NSData to allocate the space needed for the array
and use normal C methods to access the data as a multidimensional
array.
-Shawn
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.