cocoansmatrix

NSMatrix has too many buttons?


I'm trying to make a radio button set with two options, "Single" and "Sweep". I dragged a radio button into my storyboard and then added it to a matrix using Editor->Embed in. I then changed the number of rows to two.

I see two radio buttons in the IB display, the Inspector says there's two rows, and when I run it I only see two buttons. However, there are three buttons in the hierarchy display:

enter image description here

It seems the second one named "Single" is real, when you click on the lines in the left pane you can see a shadowed selection appear in the same place as the first button. I tried everything I could to delete that entry, but nothing seems to work.

This may simply be a IB bug that I should report, but I'm not sure I simply didn't do something wrong in setting this up. Anyone else seen anything like this?


Solution

  • The first cell under the matrix in the document outline is the prototype cell. From the NSMatrix Class Reference:

    The prototype cell that’s copied whenever the matrix creates a new cell.

    NSMatrix has a bunch of methods like addRow and insertColumn: that make copies of the prototype.