Re: TableView displaying a zillion empty rows
Re: TableView displaying a zillion empty rows
- Subject: Re: TableView displaying a zillion empty rows
- From: Steve Christensen <email@hidden>
- Date: Mon, 06 Jul 2009 12:32:38 -0700
On Jul 6, 2009, at 11:50 AM, Greg Guerin wrote:
Brian Hughes wrote:
-(int) numberOfRowsInTableView: (NSTableView *)aTableView
{
int returnValue;
if (aTableView == gameScoresTableView) //This works as expected
{
if (currentIndex_>= 0)
{
LNPlayer *currentPlayer = [playersArray objectAtIndex:
currentIndex_];
NSMutableArray *tempGameRecordsArray = [NSMutableArray
arrayWithArray: [currentPlayer gameRecordsArray]];
returnValue = [tempGameRecordsArray count];
}
else
{
NSBeep ();
NSLog (@"ERROR in LNAppController -- numberOfRowsInTableView:");
return -1;
}
}
else if (aTableView == playerManagementTableView) //This is the
one that doesn't work
{
returnValue = [playersArray count]; //[playersArray count] = 22
NSLog (@"playersArray count = %d", returnValue); //returnValue
= 22
}
return returnValue; //However if I change this to: return
returnValue = 22 it works fine!
}
What will returnValue be if aTableView is neither
gameScoresTableView nor playerManagementTableView?
Looks like an uninitialized local variable.
Also, for your error case (table is gameScoresTableView and
currentIndex_ is negative), is that a situation you should allow to
happen or is that something that could be handled better/differently
by the underlying model or within your controller? What does
NSTableView do when you tell it there are -1 rows?
steve
_______________________________________________
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