문제

I have an NSMatrix in my code, specifically radio buttons. I would like to create a delegate to post a message when the radio button selection is changed.

Which delegate do I have to use? I have tried the textDidChange Method without any success.. obviously, I have used the [radioButtons setDelegate:self] at the initialization stage of the application.

Thanks

도움이 되었습니까?

해결책

NSMatrix is a subclass of NSControl, so you can use the same target-action paradigm as with any other NSControl such as a push button.

You can set the target and action on the NSMatrix using interface builder (control drag from the matrix to a class) or in code with setTarget: and setAction:. Then, when a cell in the matrix (here, a radio button) is selected, the action method is called, and you can query which radio button was selected with the selectedCell method.

See https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/Button/Articles/QueryMatrixButtons.html

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top