I'd like to add a segmented control with menu like in Xcode toolbar to my OS X app. It will switch between three screens and also needs to have some options in each screen in the form of menu.
The standard segmented control does not allow "Select one" mode when I add menu to it.
This functionality is built in. In code, you can just use the -setMenu:forSegment:
method of NSSegmentedControl
(or NSSegmentedCell
). In Interface Builder, just drag a menu from the Object library and drop it on the appropriate segment.
To allow the segment with a menu to be selected when being clicked, you may need to use a custom subclass of NSSegmentedControl
which overrides -startTrackingAt:inView:
to set the segment to selected before calling through to super.