• 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
NSTableView does not show contents on startup
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSTableView does not show contents on startup


  • Subject: NSTableView does not show contents on startup
  • From: Administrator <email@hidden>
  • Date: Mon, 25 Aug 2003 10:45:37 +0100

Hello,

I am trying to write an app which displays a table of information. I have created
a window containing an NSTableView wrapped in an NSScrollView.

I also have a controller class which is set to be the application's delegate. It
implements the applicationDidFinishLaunching method in which it loads data
from a file and populates an NSArray (which contains the table's data).

The controller it also set as the NSTableView's data source.

The problem is that on startup the window appears but the table is empty.
Resizing the window has no effect, nor does switching to another app
(which covers the table window). However resizing the window or minimizing
it and then bringing it back to the front both result in the table being displayed
with it's data.

It therefore appears that the table does not cause it's data to be displayed on startup.
I confirmed this by making the controller class the NSTableView's delegate and
implementing tableView:willDisplayCell:forTableColumn:row: (which according to
the docs is called before each cell is displayed) to print a message on the console
with NSLog. No messages appeared until the window was resized.

I also tried implementing applicationWillFinishLaunching instead but with the same result.

The docs don't seem to give any further information.

(1) Can anyone tell me what I am doing wrong?

I read a recent post here suggesting that [table reloadData] needs to be called. This sounds
sensible but then I need a reference to the NSTableView so I can use it as the receiver in the
message. So my second problem:

(2) Is there a general way to obtain a reference to an object created in IB and loaded from the
nib at runtime in my code?


Any help appreciated.


Thanks,

Tim Mowlem
_______________________________________________
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.

  • Follow-Ups:
    • Re: NSTableView does not show contents on startup
      • From: Neil Earnshaw <email@hidden>
    • Re: NSTableView does not show contents on startup
      • From: email@hidden
  • Prev by Date: Filename of the file opened via the open menu
  • Next by Date: Re: NSTableView does not show contents on startup
  • Previous by thread: Re: Filename of the file opened via the open menu
  • Next by thread: Re: NSTableView does not show contents on startup
  • Index(es):
    • Date
    • Thread