Cocoa/Objective-C NSButton event handling?
I'm wondering how to handle an event on NSButton click, I've searched all over the internet and found lots of things like RightMouse button event handling, event handling on mouseup, event handling in c++, etc. but nothing that'开发者_如何学Gos just normal event handling, seems like everyone knows it already so I can't find any information about it? And I'm doing it all without .nib files or any kind of builder, it's pure text, so how do I handle button click event, I already have window and button created?
Did you try this ?
NSButton *myButton = [[NSButton alloc] initWithFrame:myFrame];
[myButton setTarget:self];
[myButton setAction:@selector(myMethodToCallOnClick:)];
精彩评论