Re: DataSource class of NSTableView - weird
Re: DataSource class of NSTableView - weird
- Subject: Re: DataSource class of NSTableView - weird
- From: Kai <email@hidden>
- Date: Mon, 10 Nov 2003 16:20:43 +0100
Do you have several objects of this class? If the array is really
global as you claim, each time you create a new object (=instance) of
this class (or Interface Builder creates one based on info from a NIB
file), that object's init method will overwrite the array you stored
in db_tables with the new one it created.
Ups, right! The array will be overwritten by a new object. I have the
creation of db_tables in "awakeFromNib"!
If you are declaring the global inside the @interface/@end part of
the header for your class, it isn't global. It's a per-instance
variable, which means each object gets its own copy, and you're only
filling one object's array, and the others remain empty.
I have the variable declaration between the #import and @interface
statements in the header file now. That is globally!?
If TablesList is an IBOutlet, note that outlets may not be set up yet
(Check if it is nil) until your object is sent awakeFromNib:. That's
exactly why awakeFromNib: exists. The NIB loader will first wire up
all outlets, and when it is finished call awakeFromNib: on all
objects. This makes sure that, if you refer to another object from
your awakeFromNib: method, its outlets have also been set up. And to
have an outlet point to another object, that one already has to have
been initialized, after all, or you may be using an invalid or
incomplete object.
Yeah, that is clear! It's allright too.
...but the table view shows nothing! :( I used NSTableView many times
successfully, only here these problems.
I don't explain me this! Any other ideas?
Thanks
Kai
_______________________________________________
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.