Re: awakeFromNib not initialising interface objects
Re: awakeFromNib not initialising interface objects
- Subject: Re: awakeFromNib not initialising interface objects
- From: "Mike Shields" <email@hidden>
- Date: Sun, 22 Sep 2002 00:32:49 -0600
Let me guess, your text fields (or some other object) are named
id foo;
id bar;
etc...
and your action methods are
-(IBAction) setFoo:(id) sender;
-(IBAction) setBar:(id) sender;
etc...
right?
If this is the case, what's going on is that the Nib unarchiver is
using Key-Value Coding to set the outlets of your controller to the
correct objects from your nib file. Since KVC first looks for a method
with a signature of setFoo: when you have a ivar named foo, your action
method gets called in it's place.
Mike
PS: How do I know this?? I innocently changed one of my action methods
to be setFoo: and had it all of a sudden getting called at the wrong
time with my ivar all wrong and never changed from nil.
On Sunday, September 22, 2002, at 12:08 AM, Greg Hulands wrote:
I have a controller of a nib that has to do some setup of the
interface in awakeFromNib, but the objects has not been initalised at
that point (something strange). Before awakeFromNib is called, all the
action methods of the textfields are getting called. Doing a po sender
in gdb says that the NSTextFields exist, but when awakeFromNib is
called, the objects have a nil value.
The interface displays ok and not errors are logged, but i cannot do
any setup as the objects are nil.
Any ideas?
Greg
_______________________________________________
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.
_______________________________________________
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.