• 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: Quincey Morris <email@hidden>
  • Date: Tue, 7 Jul 2009 23:07:47 -0700

On Jul 7, 2009, at 22:36, Brian Hughes wrote:

So I changed my code to reflect Quincy Morris's recommendations.
-(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];}
else if (aTableView == playerManagementTableView) {NSLog (@"playersArray count = %d", [playersArray count]); //[playersArray count] = 22return [playersArray count];} else {NSLog (@"Invalid table view");return 0;}}
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.

Don't take it too hard. We do tend to, um, punish people who post imprecise problem descriptions on this list, because it's frustrating trying to help when we don't know what the problem really is. :)


More punishment coming up ...

You say "it still does not work". Let's try to pin down what that means. (Yes, you've already said, but the details were a bit different each time.) Your window has the malfunctioning NSTableView which is set to a view height of how many rows? 9? Of those visible rows, how many actually show data (as opposed to being blank filler)? 0? 9?

If your NSTableView is (say) 9 rows high and you see 9 rows of data and there is no scroll bar, but the table really has 22 rows, then the easiest possible answer is that you accidentally configured the NSTableView in IB to hide its vertical scroll bar.

A second possibility is that you've accidentally removed the NSTableView from its required enclosing NSScrollView (although I don't really know how you'd convince IB to do that).

It *might* be worth deleting the table view from your NIB file and recreating it, although that does have a sort of magical hand-waving flavor to it.

Another easy thing to try is to set a breakpoint at your data source's tableView:objectValueForTableColumn:row: method, and see if it's ever called with a row index of (say) 21. If it is, that kind of points to a problem in your NIB. If it's not, that really doesn't tell you anything much.

If you put the mouse over your table view and roll the scroll wheel up and down, does the view scroll? If you click on the last visible row to select it, then press the up or down arrow key, does the selection stay where it is or does the view scroll or does the selection disappear?

Finally, have you checked the console log for error messages? (It's easy to forget to look.) Either open the console window in Xcode while the app is running (Command-Shift-R by default), or use the Console application to look at the system log. Exceptions can often cause apps to behave in mysterious, almost magical, ways without actually appearing to crash.

You can finish the beer first if you want.


_______________________________________________

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: Re: TableView displaying a zillion empty rows
  • Previous by thread: RE: TableView displaying a zillion empty rows
  • Next by thread: Re: TableView displaying a zillion empty rows
  • Index(es):
    • Date
    • Thread