Re: DataSource class of NSTableView - weird
Re: DataSource class of NSTableView - weird
- Subject: Re: DataSource class of NSTableView - weird
- From: "M. Uli Kusterer" <email@hidden>
- Date: Mon, 10 Nov 2003 15:01:49 +0100
At 14:27 Uhr +0100 10.11.2003, Kai wrote:
- (id)init {
[super init];
db_tables = [[NSMutableArray alloc] init]; // "db_tables" is a global
array, defined in the header file.
return self;
}
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.
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.
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.
Could any of these be your mistake?
--
Cheers,
M. Uli Kusterer
------------------------------------------------------------
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de
_______________________________________________
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.