Re: Query: IBOutlet fails if setter method of same name exists
Re: Query: IBOutlet fails if setter method of same name exists
- Subject: Re: Query: IBOutlet fails if setter method of same name exists
- From: "Erik M. Buck" <email@hidden>
- Date: Mon, 13 May 2002 12:54:33 -0500
The documentation in question:
<Quote>
This class manages an outlet connection in Interface Builder. The label is
of the form "value". If the source contains a method of the form setValue: ,
then that method is called with the destination as the argument. Otherwise,
if the label is the name of an instance variable in the source, then that
instance variable is set to the destination.
<End Quote>
I believe the key/value stuff added to Cocoa also uses an accessor "set"
method if one is available. I won't directly comment how well or poorly
this behavior is documented, but a search on "set outlet" produced the quote
above as the second or third hit.
----- Original Message -----
From: "Vince DeMarco" <email@hidden>
To: "ruffnex" <email@hidden>
Cc: <email@hidden>
Sent: Monday, May 13, 2002 12:00 PM
Subject: Re: Query: IBOutlet fails if setter method of same name exists
>
On Monday, May 13, 2002, at 09:27 AM, ruffnex wrote:
>
>
> Hi,
>
> Consider the following:
>
>
>
> IBOutlet id foobar; // where foobar outlet is connected to foobar
object,
>
> e.g. CheckBox button
>
>
>
> -(void)setFoobar:(BOOL)boolean; // a method I want to use from within
my code
>
>
>
>
>
> On running the above code, foobar is nil. It's not connected! If the
method is renamed, so it doesn't look like a standard setter, than foobar is
connected to a real NSButton. Strange behaviour eh?
>
>
>
> Perhaps I've missed something obvious - would appreciate someone
shedding some light on this. Apologies if it's blatantly obvious, but it's
something that caused me hours of pain (and perhaps to others as well).
>
>
>
>
This behaves as designed, unfortunately this isn't documented very well.
>
>
>
vince
>
_______________________________________________
>
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.