在Cocoa Apps的Objective-C中,可以使用这种方法来始终保持窗口的顶部?
如何实现与Swift相同?
self.view.window?.level = NSFloatingWindowLevel
导致构建错误使用未解析的标识符’NSFloatingWindowLevel’
你必须这样做:
原文链接:https://www.f2er.com/swift/320413.htmlview.window?.level = Int(CGWindowLevelForKey(kCGFloatingWindowLevelKey))
使其浮动在所有其他窗口之上:
window.level = Int(CGWindowLevelForKey(kCGMaximumWindowLevelKey))
Swift 2.x
window.level = Int(CGWindowLevelForKey(.FloatingWindowLevelKey)) window.level = Int(CGWindowLevelForKey(.MaximumWindowLevelKey))
Swift 3.0
window.level = Int(CGWindowLevelForKey(.floatingWindow)) window.level = Int(CGWindowLevelForKey(.maximumWindow))