Re: Newbie Question: Multidimensional NSMutableArray Creation
Re: Newbie Question: Multidimensional NSMutableArray Creation
- Subject: Re: Newbie Question: Multidimensional NSMutableArray Creation
- From: Scott Anguish <email@hidden>
- Date: Mon, 14 May 2001 11:52:45 -0400
On 5/14/01 5:35 AM, "William Jamieson" <email@hidden> wrote:
>
>
I am new to java and java-cocoa programming and I have been trying to figure
>
out a workaround to create a multidimensional NSMutableArray.
>
>
I have a NSTableView (with 4 columns and a variable number of rows) in a
>
window with a custom class as its DataSource. What I really want to do is
>
have an Parent NSMutableArray that is an array of Rows (also
>
NSMutableArrays). Thus creating a (workaround) multidimensional Array
>
(similar to a String[][] in java).
>
>
When I need to access cell data (eg. Row 3, Column 2) from the Array System
I'd not use a multi-dimensional array for this..
I'd suggest using instead an array of NSDictionary items... Since you
have a fixed number of horizontal fields (which are likely things like
"name" "Address" "city" "state" or some other set of keys that correspond
directly to your data) this would be very easy to do
In fact, have a look at this sample code.. It might help
http://homepage.mac.com/sanguish/SetTheTableView-1.0-src.tgz