I'm trying to group 2 radio buttons in cocoa application.
but unlike in iOS, where you can connect the buttons with control-drag
(as shown in the picture)
in cocoa application I didn't find any elegant way to do so...
any suggesting before I do something ugly?
so here is my not very elegant solution -
NSArray* _radioButtonsArray;
initialize it in viewDIdLoad:
_radioButtonsArray = [[NSArray alloc] initWithObjects:_radioButton1,_radioButton2,_radioButton3, nil];
define a radioButtonIsPressed method and connect it to all radio buttons as an action:
-(IBAction)radioButtonIsPressed:(id)sender{
for (NSButton* btn in _radioButtonsArray){
if (btn != sender)
[btn setState:0];
}
}