NSTableView Data Source problems
NSTableView Data Source problems
- Subject: NSTableView Data Source problems
- From: David Kopec <email@hidden>
- Date: Mon, 28 Jan 2002 18:10:15 -0500
It seems no matter what I put in for return values of these two methods,
my applications will crash when the tableview is clicked on or the
window's resize box is clicked on. The table does however load the data
correctly into the table. Ignore the NSLogging, that's just debug
stuff. Even if I just remove all the code all together from the methods
and just have the first return something arbitrary like 15 and the
second return @"test" it crashes in the above way. It doesn't have to
do with the rest of my application either, since taking out the data
source methods results in smooth riding. The crash is a SigBus 10.
- (int)numberOfRowsInTableView:(NSTableView *)aTableView
{
if ([array count] > 2)
{
NSLog(@"returning [array count] - 2 for number of rows in table
view");
return [array count] - 2;
}
else
{
NSLog(@"returning 0 for number of rows in table view");
return 0;
}
}
- (id)tableView:(NSTableView *)aTableView
objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex
{
if ([aTableColumn identifier] == @"Track")
{
NSLog(@"Returning row index");
return [NSString stringWithFormat:@"%d", rowIndex];
}
else
{
NSLog(@"Returning objectatindex in array");
return [array objectAtIndex:rowIndex+2];
}
}