• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: TableView displaying a zillion empty rows
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: TableView displaying a zillion empty rows


  • Subject: Re: TableView displaying a zillion empty rows
  • From: Andy Lee <email@hidden>
  • Date: Wed, 08 Jul 2009 02:18:04 -0400

On Jul 8, 2009, at 1:36 AM, Brian Hughes wrote:
So I changed my code to reflect Quincy Morris's recommendations.

Something removed the indentation from your code, so I've re-added it below:


-(int) numberOfRowsInTableView: (NSTableView *)aTableView {
if (aTableView == gameScoresTableView) //This works as expected
{
LNPlayer *currentPlayer = [playersArray objectAtIndex: currentIndex_];
NSMutableArray *tempGameRecordsArray = [NSMutableArray arrayWithArray: [currentPlayer gameRecordsArray]];
return [tempGameRecordsArray count];

A side note, not related to your problem: there's no reason to make a copy of the gameRecordsArray. You could say


NSMutableArray *tempGameRecordsArray = [currentPlayer gameRecordsArray];
return [tempGameRecordsArray count];


or simply

		return [[currentPlayer gameRecordsArray] count];

}
else if (aTableView == playerManagementTableView)
{
NSLog (@"playersArray count = %d", [playersArray count]); // [playersArray count] = 22
return [playersArray count];
}
else
{
NSLog (@"Invalid table view");
return 0;
}
}

There's another part to your code that we haven't seen, which is your tableView:objectValueForTableColumn:row: method. Out of curiosity, can you show us that code? I assume it is similarly structured to handle the two table view cases. If you put an NSLog in the playerManagementTableView case, is it not called 22 times?


The results you've described "can't" be happening, because it seems you're doing everything right. If you want to send me your project off-list I'd be happy to try to track down the problem (and treat the code as confidential, of course). These kinds of "impossible" results drive me nuts.

Since I only have two table views in my program the "Invalid table view" is never called. The first table view gameScoresTableView works perfectly. The playerManagementTableView does not. I do not create the table views progammatically. I use IB. I do not use bindings. My delegates are set correctly and are the same for both table views. I don't know enough about programming nor am I arrogant enough to think that there is something wrong with NSTableView. I have always thought the error was in my code. That is precisely why I asked for help. I couldn't seem to figure out what to do next. I have learned more about table views so I appreciate all the help. However it still does not work. I am going to try removing infrastructure and see if I can find the problem. Any other suggestions would be welcome. If I figure it out I will let you know. Meanwhile I am going to shine that streetlight on the bottle of beer on my desk. Maybe the solution is in there.

If it is, let us know. That would be a welcome breakthrough in computer science. :)


--Andy


_______________________________________________

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


References: 
 >Re: TableView displaying a zillion empty rows (From: Greg Guerin <email@hidden>)
 >Re: TableView displaying a zillion empty rows (From: Steve Christensen <email@hidden>)
 >RE: TableView displaying a zillion empty rows (From: Brian Hughes <email@hidden>)
 >Re: TableView displaying a zillion empty rows (From: Steve Christensen <email@hidden>)
 >RE: TableView displaying a zillion empty rows (From: Brian Hughes <email@hidden>)

  • Prev by Date: Re: TableView displaying a zillion empty rows
  • Next by Date: iPhone camera control like RedLaser
  • Previous by thread: Re: TableView displaying a zillion empty rows
  • Next by thread: NSApplication and UIApplication
  • Index(es):
    • Date
    • Thread