我有一个使用 NSWindowController 显示的 NSWindow。如果我将窗口级别设置为除零以外的任何值,然后将窗口小型化和小型化,它就会消失。动画显示窗口缩小,但动画一结束它就消失了。
class ViewController: NSViewController {
var controller:NSWindowController?
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
override var representedObject: Any? {
didSet {
// Update the view, if already loaded.
}
}
@IBAction func buttonPressed(_ sender: Any) {
self.controller = NSWindowController(windowNibName: .init("FloatingWindowController"))
self.controller?.window?.level = .floating
self.controller?.showWindow(nil)
}
}