你不能删除工具栏上的应用程序标题菜单,但以下操作可以删除它下面的所有命令.首先,将以下代码行添加到您的App struct
中:
@NSApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
然后,创建一个名为AppDelegate的新文件(或者您可能记得的任何东西--它也可以在同一个文件中).创建一个AppDelegate
:
//In the file, you must import `AppKit`
class AppDelegate: NSObject, NSApplicationDelegate {
func applicationWillFinishLaunching(_ notification: Notification) {
NSWindow.allowsAutomaticWindowTabbing = false //<-- This is the key!
//This will hide all of the fullscreen and tab menu controls
}
}
这段代码在Xcode14和MacOS13上进行了测试.
https://stackoverflow.com/a/65634944/20384561个
https://developer.apple.com/documentation/appkit/nswindow/1646657-allowsautomaticwindowtabbing个