On Jan 24, 2010, at 10:27 am, Chunk 1978 wrote:

> refactoring code so one method for the same button can handle a small
> if/else statement could easily be considered more ideal than having
> two separate methods.
> 
No, it couldn't. If you have different actions that should happen in response 
to different control events, then the trivial thing to do is to implement 
different methods for each.

> i understand your concern, but you haven't provided an answer.
> 
You haven't provided a good problem statement or description of why you want to 
do something that runs counter to the common Cocoa pattern. In particular, in 
the original post:

> -(IBAction)myButton:(id)sender
> {
> if (sender.UIControlEvent =
> forControlEvents:UIControlEventTouchUpInside) NSLog(@"touchUp");
> }
> 

It's really not helpful to post code that is obviously neither code that you 
could possibly be using in an application nor flagged as pseudo-code. What is 
this snippet supposed to convey?

See also <http://catb.org/~esr/faqs/smart-questions.html>.


> in fact, i've searched for hours and i can't find an answer.  
> 
Where have you looked, and for what?

> at this point i'm wondering if it's even possible.

> 
Shouldn't this rather suggest that "one method for the same button can handle a 
small if/else statement might not be considered more ideal than having two 
separate methods"?

mmalc

_______________________________________________

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 arch...@mail-archive.com

Reply via email to