How to bind click action of NSButton in view based NSTableView

Viewed 1633

I have an NSTableView that is set to be 'view based', and within each NSTableCellView there is an NSButton and an NSTextField.

The text field is being populated correctly from an array controller. The buttons are appearing correctly but I'm having trouble working out how to hook up the click action.

I thought this would be possible by control-dragging from the NSButton in IB to a simple method like this one in my controller (in this case an NSDocument subclass):

- (IBAction)testAction:(NSButton *)sender {
    NSLog(@"Test action");
}

It connects fine but never gets fired. Any ideas why this is or how to fix it?

2 Answers
Related