简体   繁体   English

即使选项卡组中有多个 windows,NSWindow 选项卡栏也会隐藏

[英]NSWindow tab bar is hidden even with multiple windows in the tab group

I'm trying to add tabs to an old codebase, and followed along the documentation.我正在尝试将选项卡添加到旧代码库,并遵循文档。 But the tab bar remains hidden, even with multiple windows in the tab group: The menu Window > Show Previous Tab and Window > Show Next Tab work as expected.但是标签栏仍然隐藏,即使标签组中有多个 windows:菜单Window > Show Previous TabWindow > Show Next Tab按预期工作。

With a breakpoint after:之后有一个断点:

self.window?.addTabbedWindow(newWindow, ordered: .above)
newWindow.orderFront(self.window)
newWindow.makeKey()

The tab bar is visible, until I continue the breakpoint.选项卡栏是可见的,直到我继续断点。

Inspecting the NSWindow.tabGroup.tabBarVisible before and later also has the tab bar set as visible.检查NSWindow.tabGroup.tabBarVisible之前和之后也将标签栏设置为可见。

Turns out the tab bar is implemented as a NSTitlebarAccessoryViewController and is part of the NSWindows.titlebarAccessoryViewControllers .结果标签栏被实现为NSTitlebarAccessoryViewController并且是NSWindows.titlebarAccessoryViewControllers的一部分。

The problem was we also used a NSTitlebarAccessoryViewController in our app, and removed it by iterating all NSWindows.titlebarAccessoryViewControllers and removing each one.问题是我们还在我们的应用程序中使用了NSTitlebarAccessoryViewController ,并通过迭代所有NSWindows.titlebarAccessoryViewControllers并删除每一个来删除它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM