Re: NSTable Newbie Issues
Re: NSTable Newbie Issues
- Subject: Re: NSTable Newbie Issues
- From: Esteban Uribe <email@hidden>
- Date: Tue, 13 Jul 2004 17:11:50 -0700
Kodex,
Seems like you are using an NSArray (records) as a data source.
However, NSArray does not respond to the protocol NSTableDataSource
You may get an exception thrown, and halted execution.
Seems like your class personalTable does respond to NSTableDataSource
protocol. Try passing self instead of records to setDataSource on
your table. The the table will call personTable when it needs data to
display.
I hope this helps
-Esteban "codeX", "codeonezero" Uribe
On Jul 13, 2004, at 2:45 PM, Kodex wrote:
I am trying to get a few tables working on my app. I
have a diffrent controller for each one. And 3 out of
the 4 will have static data. I having been trying to
follow the guides out there and none of them seem to
work. I compile with no errors and console dosnt dump
any errors on me. I was wondering if anyone could spot
the trouble with my code. Thanks
//Header file contents
// IBOutlet NSTableView *personal_Table;
// NSMutableArray *records;
// NSString *name;
#import "personalTable.h"
@implementation personalTable
-(void)windowDidLoad
{
[personal_Table setDataSource: records];
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
__________________________________
Do you Yahoo!?
Yahoo! Mail - 50x more storage than other providers!
http://promotions.yahoo.com/new_mail
_______________________________________________
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.
_______________________________________________
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.