NSToolbar: how do I initialise with a selected item?

末鹿安然 提交于 2019-12-07 05:21:12

问题


I have a Mac OS application with a preferences window with a NSToolbar on it.

I have also a custom subview under it and other 3 custom views that are loaded inside the first one when the user clicks on one of the options.

So far, so good. Now I realised the first item is not selected by default when the window is loaded.

I see no options in the inspectors, except the "selectable", which I used. But there is no "selected". Should I do it programmatically? How?


回答1:


NSToolbar has a -setSelectedItemIdentifier: method that you can use in your -windowDidLoad method.



来源:https://stackoverflow.com/questions/11004072/nstoolbar-how-do-i-initialise-with-a-selected-item

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