我正在尝试在 OSX、Xcode 8、Swift 3 中实现单选按钮。我可以在过去的 Xcode 迭代中使用单选按钮组来实现这一点。我相信应该有一种方法可以在 Xcode 中对单选按钮进行分组,以便它们的选择是排他性的,但我不知道如何实现。有人可以解释一下现在该怎么做吗?
An NSButton configured as a radio button (with the -buttonType set to NSRadioButton), will now operate in a radio button group for applications linked on 10.8 and later. To have the button work in a radio group, use the same -action for each NSButton instance, and have the same superview for each button. When these conditions are met, checking one button (by changing the -state to 1), will uncheck all other buttons (by setting their -state to 0).
...但我无法在 Interface Builder 中弄清楚如何为每个 NSButton 实例分配相同的操作。我从第二个按钮拖动到 Xcode IDE 中的一个 Action ,它似乎无法选择相同的 Action 。有人可以解释正确的过程吗?
非常感谢!
最佳答案
关于swift - 如何在 OSX、Xcode 8、Swift 3 中实现单选按钮?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41539229/