尝试使用以下内容设置swift
即时Use of unresolved identifier 'window'
错误时设置窗口级别:
window.level = Int(CGWindowLevelForKey(Int32(kCGScreenSaverWindowLevelKey)))
或
window.level = NSScreenSaverWindowLevel
Ive经过检查 这里How to set window level in Swift
此处Mac OS X, make a window go over menu bar
我似乎无法访问NSViewController
或NSWindowController
窗口属性
答案 0 :(得分:10)
Swift 2更新:
panel.level = Int(CGWindowLevelForKey(CGWindowLevelKey.PopUpMenuWindowLevelKey))
答案 1 :(得分:4)
子类NSWindowController
windowDidLoad()
中的
window?.level = Int(CGWindowLevelForKey(Int32(kCGScreenSaverWindowLevelKey)))
答案 2 :(得分:3)
Swift 3更新:
window.level = Int(CGWindowLevelForKey(CGWindowLevelKey.popUpMenuWindow))