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
But what if a want a selector with more then one parameter like:
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?
You can't. The target-selector pattern is meant for a user interface where you have zero or one parameters to send. The only parameter you might have is the caller, probably the button itself. Any other data would have to be accessible elsewhere by the target. There are a number of patterns likes this that take only zero or one arguments. In a few cases, you can use an NSInvocation or GCD block where you have more options.