Pregunta

I am iOS developer and I want to develop a Mac app (it's basically a "port" from an iOS app). In IB in iOS is very easy to connect one UIButton to two or more actions. I have noticed that in a Mac App I only can connect a NSButton to a single action. Is there a way to connect an NSButton to more than one action?

¿Fue útil?

Solución

Is there a way to connect an NSButton to more than one action?

NO. This is not supported in OSX Cocoa applications.

You need to setAction: yourself based on conditions, But only one at a time can be used.

In case you want to call two methods(actions), in the IBAction method you need to call them.

-(IBAction)multipleActions:(id)sender{
    [self method1:sender];
    [self method2:sender];
}
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top