How to create NSRadioButton Group in Xcode 7 OSX

2020-02-26 14:42发布

I was following this tutorial on how to create radio button group. But it seems Radio Group is no longer available in the Xcode 7 library and I didn't find much information about it. How do I create something like this:

enter image description here

Thanks very much.

3条回答
老娘就宠你
2楼-- · 2020-02-26 15:02

Quoting from the Xcode 7 release notes:

The template for Radio buttons in the Interface Builder object library is now implemented as individual NSButton objects, rather than the older NSMatrix, which is discouraged on OS X v10.8 and later. Radio buttons automatically act as a group (selecting one button will unselect all other related buttons) when they have the same superview and -action method. (16965941)

So drag individual radio buttons and make sure you connect them all to the same outlet!

查看更多
Animai°情兽
3楼-- · 2020-02-26 15:03

Thanks to Eric's advice, I went back and placed the radio buttons in the same superview and it worked. enter image description here

查看更多
The star\"
4楼-- · 2020-02-26 15:15

This way of doing radio button groups is "soft deprecated", follow what Xcode 7 says when selecting a radio button:

Xcode 7 radio button

查看更多
登录 后发表回答