NSButton添加事件
-(void)addButton { NSButton* pushButton = [[NSButton alloc] initWithFrame: NSMakeRect(100, 100, 100, 100)]; pushButton.bezelStyle = NSRoundedBezelStyle; [pushButton setTarget:self]; [pushButton setAction:@selector(buttonClick:)]; [self.window.contentView addSubview:pushButton]; } -(void)buttonClick:(id)sender { }