Cocoa: Tab view with toolbar icons for switching tabs

狂风中的少年 提交于 2019-11-30 10:30:35

Since Mac OS X 10.10 (Yosemite), the easiest way to do this is to lay out your preferences dialog window in a storyboard using an NSTabViewController, and set its tabStyle to NSTabViewControllerTabStyleToolbar.

WWDC 2013 Session 212: Storyboards and Controllers on OS X walks through this scenario starting around 10m45s.

BWToolkit has code that does what you want.

If you fancy implementing it yourself, you could take a look at the code and see what it's doing. Hint: NSToolbar's delegate protocol has a toolbarSelectableItemIdentifiers: method, and you can create a tab view without showing tabs, switching between tabs programmatically.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!