26

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.

Audrey Li
  • 980
  • 2
  • 11
  • 14
  • Maybe [this](http://stackoverflow.com/a/29117898/2976077) post can help you. – milo526 Jun 28 '15 at 20:38
  • Thanks. But this requires 3rd party and it's also for iOS, not OS X... – Audrey Li Jun 28 '15 at 20:55
  • 1
    Thanks. I should have been more careful when reading the introduction. It worked! – Audrey Li Jun 28 '15 at 21:38
  • All answers do not cover the following change of behavior. In the past, I could bind some controller member to the NSMatrix (or radio-group) selection, and so have a value which is always synchronized with the selected radio button. Now I can't, since they're all individual buttons. I am forced to implement an Action (which I don't really need) for doing this (and for actual grouping of the buttons). How to go about that? – Motti Shneor May 04 '16 at 04:21

3 Answers3

31

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!

Oz Solomon
  • 2,969
  • 23
  • 22
11

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

Xcode 7 radio button

Eric Aya
  • 69,473
  • 35
  • 181
  • 253
5

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

Audrey Li
  • 980
  • 2
  • 11
  • 14