7 Replies Latest reply: Sep 10, 2012 9:10 AM by etresoft
Silberlicht Level 1 Level 1 (0 points)

I'm trying to figure out how cocoa target-action design pattern function. So, all examples I've found set action to a selector with a single parameter, which, I suppose, is the sender of the action message and is initialized in button's event handler

 

 

[myButtonCell setAction:@selector(reapTheWind:)];

[myButtonCell setTarget:anObject];

 

But what if a want a selector with more then one parameter like:

 

[myButtonCell setAction:@selector(reapTheWind:howManyTimes:)];

[myButtonCell setTarget:anObject];

 

In this case, how and where to set the value of the howManyTimes parameter?

 

And most importantly, how to check, by means of respondsToSelector, if I'm invoking the right method?

 

I guess I have to extend the NSButtonCell and override its click event handler?


iOS 5