Re: awakeFromNib not called
Re: awakeFromNib not called
- Subject: Re: awakeFromNib not called
- From: James Spencer <email@hidden>
- Date: Tue, 11 Oct 2005 19:46:03 -0500
On Oct 11, 2005, at 12:02 PM, Paul J. Lucas wrote:
On Tue, 11 Oct 2005, Paul Bennett wrote:
The documentation is referring to the class of the File's Owner
itself. (In Interface Builder, select the File's Owner and pick
'Custom Class' from the Inspector (Cmd-5). That class there (probably
NSApplication if you've just created a simple Cocoa Application) is
the one whose -awakeFromNib will be called.
If I try to change it to my custom class Foo, I get an alert
that asks, "Do you want to change the file owner to a class
that does not inherit from NSApplication?"
Do I?
That's hard to answer but probably not. The file's owner is usually
a member of the class that loads the nib. How are you loading the
nib? If you are just letting the app load it, then you probably want
to let the app be the file's owner.
When the objects in your Nib (e.g. controls, windows and custom
objects that
you have instantiated) are deserialised from the Nib, then *their*
-awakeFromNib methods will be called.
I get that part.
It sounds very much as if no instance Foo class is loading the
Nib, and no
instance is contained within the Nib. Hence, Foo's -awakeFromNib
is not being
called.
I did explicitly select "Instantiate Foo" from the Classes menu.
And do you see an instance of Foo in the Instances pane? If so and
if your -awakeFromNib is still not being called, it would tend to
indicate that the nib file is not being loaded. On the other hand,
going back to my question above, if you are calling something like
Foo *myFoo = [[Foo alloc]init];
then -awakeFromNib won't be called even if you have an instance in
the nib file because that doesn't load the nib file.
Spence
James P. Spencer
Rochester, MN
email@hidden
"Badges?? We don't need no stinkin badges!"
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden