For Programmers: Free Programming Magazines  


Home > Archive > Objective C > November 2005 > how to use objects w/ data arrays in objectValueForTableColumn









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author how to use objects w/ data arrays in objectValueForTableColumn
Wizumwalt@gmail.com

2005-11-07, 10:05 pm

I have an NSMutableArray of DataRecord objects which looks like this
....

@interface DataRecord : NSObject
{
NSNumber * index; // index int
NSMutableArray *data; // array of 3 floats
}

My NSTableView should display the data from this DataRecord object as
such ...

Index Data1 Data2 Data3
1 2.0 3.0 1.1
2 3.2 2.2 2.3
....

What I can't figure out is how to get each value from this data array
into the columns of this table using objectValueForTableColumn method.

Any help much appreciated.

Santa Claus

2005-11-10, 9:58 pm

In article <1131416818.359187.105850@g49g2000cwa.googlegroups.com>,
"Wizumwalt@gmail.com" <Wizumwalt@gmail.com> wrote:

> I have an NSMutableArray of DataRecord objects which looks like this
> ...
>
> @interface DataRecord : NSObject
> {
> NSNumber * index; // index int
> NSMutableArray *data; // array of 3 floats
> }
>
> My NSTableView should display the data from this DataRecord object as
> such ...
>
> Index Data1 Data2 Data3
> 1 2.0 3.0 1.1
> 2 3.2 2.2 2.3
> ...
>
> What I can't figure out is how to get each value from this data array
> into the columns of this table using objectValueForTableColumn method.
>
> Any help much appreciated.


take the index (i presume that's what it's for) and get the intValue of it, feed that into the objectAtIndex method for the array and return your float value.
float mytemp = [[data objectAtIndex: [index intValue]] floatValue];


now referencing them from the datarecord is another item entirely. that i dont know how to do.
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com