Re: NSTableView Data Source problems
Re: NSTableView Data Source problems
- Subject: Re: NSTableView Data Source problems
- From: Marinus van der Lugt <email@hidden>
- Date: Tue, 29 Jan 2002 13:01:16 +0100
Hi
Are you sure the objects you display in the tableView are
properly retained?
I had the same problem. My problem was that I used convenience
constructors for the objects I displayed in the table. These objects
are auto released by default. What happens is that the table is
displayed properly, but when you click on it the app crashes
because the objects are'nt there anymore.
Best,
Rien
On Tuesday, January 29, 2002, at 12:10 , David Kopec wrote:
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];
}
}
_______________________________________________
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.