0

How to add text to segmented control in macOS so that it shows up in toolbar in text only mode?

Currently I am created the control like

let tabbar = NSSegmentedControl(labels: ["One", "Two", "Three"], trackingMode: .selectOne, target: self, action: nil)
tabbar.setSelected(true, forSegment: 0)

But if I choose text only from the toolbar, the segmented control disappears. Is it possible to add text to the segments so that it shows up in text only mode of the toolbar?

John Doe
  • 2,225
  • 6
  • 16
  • 44
  • Where are you calling this code? – koen Jul 21 '19 at 11:08
  • In the main window controller, I create a toolbar and adds it to the window. The toolbar delegate has default items set which contains the tabbar id with view to the tabbar. – John Doe Jul 21 '19 at 11:10
  • 1
    Maybe this helps: https://christiantietze.de/posts/2016/06/segmented-nstoolbaritem/ – koen Jul 21 '19 at 11:45

0 Answers0