tableview problem
tableview problem
- Subject: tableview problem
- From: Simone Gabbriellini <email@hidden>
- Date: Tue, 13 Apr 2004 12:16:09 +0200
Hello there,
I'm in a trouble
I need to load an XML plist into a tableView.
But I really can figure out the right way to do it.
Here is the code I use (as you can see, it's the code you can find in
Using Table View Article)
@implementation MostraDati
// Invoked by the table to find out how many rows of data are in the
data source.
- (int)numberOfRowsInTableView:(NSTableView *)tableView
{
NSString *filePath = [NSHomeDirectory()
stringByAppendingPathComponent:@"T_Rex/semola.txt"];
caricaDati = [NSMutableArray arrayWithContentsOfFile:filePath];
return [caricaDati count];
}
// Invoked by the table to retrieve data from the data source.
- (id)tableView:(NSTableView *)tableView
objectValueForTableColumn: (NSTableColumn *)tableColumn
row: (int)row
{
id theRecord, theValue;
NSParameterAssert(row >=0 && row < [caricaDati count]);
theRecord = [caricaDati objectAtIndex:row];
theValue = [theRecord objectForKey:[tableColumn identifier]];
return theValue;
}
// Invoked by the table view to update the data model with new data
// entered by the user.
- (void)tableView:(NSTableView *)tableView
setObjectValue:(id)object
forTableColumn:(NSTableColumn *)tableColumn
row:(int)row
{
id theRecord;
NSParameterAssert(row >=0 && row < [caricaDati count]);
theRecord = [caricaDati objectAtIndex:row];
[theRecord setObject:object forKey:[tableColumn identifier]];
return;
}
@end
This is the error I get:
2004-04-13 12:13:07.891 Meeting_Manager[1025] *** -[NSCFString
objectForKey:]: selector not recognized
2004-04-13 12:13:07.896 Meeting_Manager[1025] An uncaught exception was
raised
Maybe I should do something to the xml file before tableView tries to
load it?
Tnx really a lot
Simone
_______________________________________________
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.