Re: NSTableView questions
Re: NSTableView questions
- Subject: Re: NSTableView questions
- From: Hrishikesh Muruk <email@hidden>
- Date: Fri, 5 Oct 2007 22:06:53 +0530
I tried using the -applicationDidFinishLaunching: delegate but that
does not work quite as I expected.
Let me explain what I am trying to do again -
I have a list of items that are created dynamically. This list
(dataSrc) has to be displayed in an NSTableView. To show the list in
the table view I have also implemented the following delegates
1. - (int)numberOfRowsInTableView:(NSTableView *) aTable
2. - (id)tableView:(NSTableView*) aTable objectValueForTableColumn:
(NSTableColumn *)
When the application is run -numberOfRowsInTableView: is called
before -applicationDidFinishLaunching: . So initializing the array in
-applicationDidFinishLaunching: does not work because -
numberOfRowsInTableView: returns zero (size of array) and the table
does not get updated after that.
I want to dynamically change the contents displayed in the
NSTableView. I suppose sending a -reload: message (every time I
update the contents o the dataSrc array) to the table will work. But
in my program how do I get a reference to the NSTableView in my program?
Thanks
Hrishi
On 25-Sep-07, at 11:29 PM, I. Savant wrote:
On 9/25/07, I. Savant <email@hidden> wrote:
set up the data source array in the initialization of your
controlling
object. so if you have AppController with an NSMutableArray
property you
would setup initialize / setup the data source array in
AppControllers
init. i guess this assumes you have AppController instantiated
in your nib
file
As a followup:
http://developer.apple.com/documentation/Cocoa/Reference/
ApplicationKit/Protocols/NSNibAwaking_Protocol/Reference/
Reference.html
"Because the order in which objects are instantiated from an archive
is not guaranteed, your initialization methods should not send
messages to other objects in the hierarchy. Messages to other objects
can be sent safely from within awakeFromNib—by which time it's assured
that all the objects are unarchived and initialized (though not
necessarily awakened, of course)."
--
I.S.
---
www.greenwaysroad.com
_______________________________________________
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