RE: Simple question: How do you store a sender's ID?
RE: Simple question: How do you store a sender's ID?
- Subject: RE: Simple question: How do you store a sender's ID?
- From: "Jonathan E. Jackel" <email@hidden>
- Date: Fri, 9 Apr 2004 11:31:35 -0400
>
Am 08.04.2004 um 23:28 schrieb Jonathan E. Jackel:
>
>
> You also could set up an instance variable, with a setter and getter
>
> method,
>
> and pass the sender to the setter.
>
>
>
> [self setTextFieldThatSentAction:sender];
>
>
>
> The setter would retain the sender and release it when done. Make
>
> sure to
>
> dealloc properly to avoid leaks.
>
>
While this is formally correct, it sounds like a bad design.
>
>
If you need to refer to a specific control, you'd usually establish an
>
outlet using Interface Builder.
>
>
Otherwise, assuming you are designing according to the MVC paradigm,
>
there should be no need to know the sender outside of your action
>
method.
The way I understood the question was that the user makes a runtime decision
and the app changes the title of the button the user chose at some later
time, perhaps in response to some other button click. Outlets don't help
you with this problem. Knowing the last button clicked is unnecessary a lot
of the time, but that does not make accessors (in addition to, not instead
of, outlets) a bad design when appropriate.
Jonathan
_______________________________________________
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.