【发布时间】:2016-04-04 13:58:19
【问题描述】:
有没有办法在全屏模式下隐藏(而不是禁用)OS X 状态栏和停靠?
我有这个代码:
func applicationDidFinishLaunching(aNotification: NSNotification) {
/* Pick a size for the scene */
if let scene = MainMenuScene(fileNamed:"GameScene") {
if let screen = NSScreen.mainScreen() {
window.setFrame(screen.frame, display: true, animate: true)
window.collectionBehavior = NSWindowCollectionBehavior.FullScreenPrimary
}
NSApplicationPresentationOptions.AutoHideMenuBar
skView.showsFPS = false
skView.showsNodeCount = false
skView.ignoresSiblingOrder = false
/* Set the scale mode to scale to fit the window */
scene.scaleMode = .AspectFill
scene.size = skView.bounds.size
self.skView!.presentScene(scene)
}
}
但我得到这个错误:
Failed to set (collectionBehavior) user defined inspected property on (NSWindow)
错在哪里?
【问题讨论】:
-
如果在窗口出现后设置
NSWindowCollectionBehavior.FullScreenPrimary呢? -
我尝试将 NSWindowCollectionBehavior.FullScreenPrimary 放在 MainMenuScene.swift 文件的 didmovetoview 中...但没有运气,菜单栏和停靠栏仍然可见...
标签: swift macos menu fullscreen dock