> Even if his scenario matches your description, is a big switch statement
> really a good solution?  Your suggesting that he throw away the whole point
> of the IBAction methodology (sending events to the actual method that is
> going to process them) for what advantage?  What's he's describing IS view
> behavior.  It's a type of button.  It's not the same type of button as Apple
> already implements, but it's most certainly a button.

  The point is well made - I was discussing this off-list with another
list member and yes, a switch statement in the case of a distinct
action for each button is ridiculous. I am thinking of a situation
where the buttons more or less do the same thing but there is some
small difference. I believe that's why action methods take an id
sender and senders have tags, no?

  Here's what I said:

>  Well obviously if you have many distinct actions, that solution
> isn't very attractive. If you have several buttons that do one thing
> and several that do another (totaling two actions), that'd be far
> better, IMO.
>
>  Now if you do have one distinct action for each button, reverse the approach:
>
> - (void)lockButton:(id)button
> {
>    // Lock it down, make a "crushed glass" sound,
>    // cause vapor to rise from it and liquid to drip,
>    // make elements beneath it bubble and singe, etc.
> }
>
> - (IBAction)actionOne:(id)sender
> {
>    [self lockButton:sender];
>    [self doSomethingTotallyAwesome];
> }
>
> - (IBAction)actionTwo:(id)sender
> {
>    [self lockButton:sender];
>    [self doSomethingEvenMoreAwesome];
> }
>
>  ...

> You can argue that he should implement his button logic in IBAction for
> pragmatic reasons that he shouldn't go to the trouble of subclassing for a
> control he's only going to use once, but on pure MVC ground I don't think
> you can argue that this isn't part of the view.

  ... 'til I'm blue in the face, I most certainly can. :-) The thing
is, I think like anything turned into a religion, I don't believe
individual interpretations will ever completely agree, but I've made
my point in previous posts and I stand by it (ie, the button already
allows this behavior). Of *course* this is just my opinion
(interpretation) but I stand by it. :-)

--
I.S.
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to