Re: NSTableView Problems
Re: NSTableView Problems
- Subject: Re: NSTableView Problems
- From: Barry Fawthrop <email@hidden>
- Date: Sun, 23 Nov 2008 19:21:16 -0500
Thank You
my datasource methods are as follows:
-(int) numberOfRowsInTableView:(NsTableView *)table {
return [schedule count];
}
-(id)talbeview: (NSTableView *)table objectValueForTableColumn:
(NSTableColumn *)col: row:(int)row {
return [schedule objectAtIndex: row];
}
Can/Should I perhaps add a second controller, this time an Array
Controller (the current one is NSObject based),
And use just the Array Controller for the NSTableView ?
Would this met your suggestion on a object class?
Thanks again
Barry
Graham Cox wrote:
>
> On 24 Nov 2008, at 10:43 am, Graham Cox wrote:
>
>>> [schedule addObject: [NSArray arrayWithObjects: @"TIME", filename,
>>> length, nil]];
>
>
> A further comment.
>
> While managing your data this way is OK, and may fit your application
> well, I personally wouldn't do it this way.
>
> Instead, define an object class that has a filename, length and time
> values as properties. Then your list becomes trivially easy to manage as
> each related piece of data is always held together. In other words a
> general-purpose array is not a good substitute for a custom object that
> links the various bits of data together meaningfully.
>
> You'll also find that driving a table view is much easier - the code
> snippet I posted always works when you do it this way, provided your
> write your property accessors correctly.
>
>
> hth,
>
>
> Graham
>
>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden