I'd like to implement a segmented control in Cocoa, not iOS. I created and populated a Segmented Control in Xcode's IDE and connected it to an IBOutlet:
@IBOutlet weak var prepChoice: NSSegmentedControl!
I then attached it to this function:
@IBAction func getprepChoice(_ sender: Any) {
switch prepChoice.indexOfSelectedItem
{
case 0:
print( "zero" )
case 1:
print( "one" )
default:
break
}
}
But I am getting errors along the lines of "[General] -[NSView indexOfSelectedItem]: unrecognized selector sent to instance"
What does this error mean?