退出全屏NSView后恢复菜单栏

问题描述 投票:0回答:1

我将NSView设置为全屏模式,并且隐藏菜单栏没有问题。我的问题是退出全屏模式时。如何还原菜单栏?我尝试使用和不使用选项,但结果保持不变:菜单栏丢失:

func exitFullScreen()  {
    let presOptions: NSApplication.PresentationOptions = [.hideDock, .hideMenuBar]
    let optionsDictionary = [NSView.FullScreenModeOptionKey.fullScreenModeApplicationPresentationOptions: NSNumber(value: presOptions.rawValue), NSView.FullScreenModeOptionKey.fullScreenModeAllScreens: false]
    presentationWindowController.window?.contentView?.exitFullScreenMode(options: optionsDictionary)
}
swift macos cocoa fullscreen nsview
1个回答
0
投票

实际上,我只需要再次设置应用演示选项:

 NSApplication.shared.presentationOptions = []
© www.soinside.com 2019 - 2024. All rights reserved.