NSTableView retain count problem
NSTableView retain count problem
- Subject: NSTableView retain count problem
- From: Shane <email@hidden>
- Date: Sat, 21 Nov 2009 17:49:54 -0600
I have an NSTableView where the data source and delegate are assigned
to an NSViewController, and in this controller I have the two data
source methods.
numberOfRowsInTableView
tableView: objectValueForTableColumn row:
This project was previously done through xcode using Tiger, and I've
just now imported it in Snow Leopard. My problem is that my table view
isn't being populated. I see numberOfRowsInTableView being called, but
it's always returning 0. So I looked at 'records' and the retain count
is always 0, yet 'records' in my other method 'createDictionary' which
populates the table is always 1.
@interface DataViewController : MainViewController {
…
NSMutableArray *records;
}
- (id) init
{
records = [[NSMutableArray alloc] init];
}
- (int) createDictionary
{
[records autorelease];
// retain count for records at this point is 1.
while (…) {
[records addObject:currentLine];
}
[myTableView reloadData];
// retain count for records at this point is 1.
// records is not populated and returns the proper count.
return [records count];
}
This method gets called before (when NSTableView is setup) and during
createDictionary (where I populate my NSTableView) and always returns
0.
- (int) numberOfRowsInTableView:(NSTableView *)tableView
{
// retain count for records at this point is always 0.
return [records count];
}
Anyone see what I'm doing wrong here, or know how I can better track this down?
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden