According to Big Nerd Ranch book "Cocoa programming for OS X" old way of using NSMatrix is going to be deprecated.
New way is to use several instances of NSButton
with style set to Radio
.
Each of NSButton
from the same radio group should be assigned to one shared @IBAction
method. And use tag
property to distinguish them in this action method.
Question is: How currently checked
NSButton
from radio group gets notification that another button was clicked, and current button should change its state to unchecked?
I know about question: How to create NSRadioButton Group in Xcode 7 OSX but my question is not about how to create it. Question is how message reaches other NSButton views? Because Action is executed on the Window controller class, not on the views.
Picture is follow:
--> NSButton sends @IBAction ViewController.radioButtonPressed Window -| --> NSButton sends @IBAction ViewController.radioButtonPressed
But how this two instances exchange state information between themselves? It seems that there are only one way communication between them and ViewController? How one button know that another was pressed?