Re: NSTable Newbie Issues
Re: NSTable Newbie Issues
- Subject: Re: NSTable Newbie Issues
- From: Hasan Diwan <email@hidden>
- Date: Wed, 14 Jul 2004 11:21:44 -0700
Comments are delimited by ***.
On Wed, 14 Jul 2004 09:54:37 -0700 (PDT), Kodex <email@hidden> wrote:
>
> > //Header file contents
>
> > // IBOutlet NSTableView *personal_Table;
>
> >
>
> > // NSMutableArray *records;
>
> > // NSString *name;
>
> >
>
> >
>
> > #import "personalTable.h"
>
> >
>
> > @implementation personalTable
>
> >
>
> > -(void)windowDidLoad
>
> > {
>
> >
>
> > [personal_Table setDataSource: records];
***
The DataSource points to where your data source methods are defined.
It should be "self" from the looks of it.
***
>
> >
>
> > name = @"test";
>
> > [records addObject:name];
>
> >
>
> > [personal_Table reloadData];
>
> > }
>
> >
>
> >
>
> > - (id)tableView:(NSTableView *)personal_Table
>
> >
>
> > objectValueForTableColumn:(NSTableColumn
>
> > *)aTableColumn
>
> >
>
> > row:(int)rowIndex
>
> >
>
> > {
>
> >
>
> > id theRecord, theValue;
>
> >
>
> >
>
> >
>
> > NSParameterAssert(rowIndex >= 0 && rowIndex <
>
> > [records count]);
>
> >
>
> > theRecord = [records objectAtIndex:rowIndex];
>
> >
>
> > theValue = [theRecord
>
> objectForKey:[aTableColumn
>
> > identifier]];
>
> >
>
> > return theValue;
>
> >
>
> > }
>
> >
>
> >
>
> > - (void)tableView:(NSTableView *)personal_Table
>
> >
>
> > setObjectValue:anObject
>
> >
>
> > forTableColumn:(NSTableColumn *)aTableColumn
>
> >
>
> > row:(int)rowIndex
>
> >
>
> > {
>
> >
>
> > id theRecord;
>
> >
>
> >
>
> >
>
> > NSParameterAssert(rowIndex >= 0 && rowIndex <
>
> > [records count]);
>
> >
>
> > theRecord = [records objectAtIndex:rowIndex];
>
> >
>
> > [theRecord setObject:anObject
>
> forKey:[aTableColumn
>
> > identifier]];
>
> >
>
> >
>
> >
>
> > return;
>
> >
>
> > }
>
> >
>
> > - (int)numberOfRowsInTableView:(NSTableView
>
> > *)personal_Table
>
> >
>
> > {
>
> >
>
> > return [records count];
>
> >
>
> > }
>
> >
>
> >
>
> > @end
--
Cheers,
Hasan Diwan <email@hidden>
_______________________________________________
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.