小型化后,NSWindow消失了

时间:2018-09-28 11:15:17

标签: nswindow makekeyandordertofront

我有一个正在使用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)
    }
}

0 个答案:

没有答案