Search code examples
cocoaxcodemacosbindingnsbutton

Bindings and NSButton


Using bindings, how can I make NSButton invoke a method in my AppDelegate class? I tried setting the target sleector to buttonClicked: but in console it gives me:

unrecognized selector sent to instance 0x100105060

Also there's no place in bindings to specify which instance to look for the method in so how can I set it to AppDelegate?

Thanks.


Solution

  • Bindings are used to synchronize a variable and an element of the interface.

    In your case, I guess an action would be better. Declare your method with IBAction and control-drag from your button to your AppDelegate instance in Interface Builder to be able to select the action.