MacOS:有什么方法可以隐藏窗口标题而不是工具栏项标签?

时间:2017-03-20 23:43:22

标签: swift cocoa swift3 nswindow appkit

我正在尝试制作一款与Apple的Mac OS App Store非常相似的应用程序,其中窗口的标题不可见,但它有一个带有图标和标签的工具栏。

App Store

问题是,当我将窗口的标题可见性设置为隐藏在我的Window Controller中时,它还会隐藏toolbarItem标签。

window?.titleVisibility = .hidden

我尝试明确设置工具栏以显示图标和标签,但似乎忽略了这一点。

toolbar.displayMode = .iconAndLabel

以下是我的应用的截图,无论是否设置标题可见性: Setting titleVisibility to .hidden Without setting titleVisibility

2 个答案:

答案 0 :(得分:1)

你可以代替

self.window?.titleVisibility = .hidden

以下

self.window.title = "" // no title but the labels for toolbar icons are there

答案 1 :(得分:0)

你需要从一个原始的&无边界的nswindow开始,你必须自己绘制它。在github上有一个很好的INAppStoreWindow(或者4年前很好;)),它可以模仿appstor的外观和感觉