我正在用Swift 3在我的苹果macOS电脑上制作一个应用程序
关闭一个窗口是很容易的[以这种方式]从我的主窗口称为w
通过点击按钮并调用函数closeotherw()
@IBOutlet var w: NSWindow!
@IBOutlet var otherw: NSWindow!
@IBOutlet var otherw: NSPanel!
@IBAction func closeotherw(_ sender: AnyObject) {
otherw.close()
}
但是如何重新打开它[otherwin]?
我也尝试了各种方式,也喜欢w.isHidden = true
,但没有结果。
我没有StoryBoard
,我也没有ViewController
。
我做的都是从AppDelegate
。
方法为:otherw.orderFront(self)
还有:
makeKeyAndOrderFront再次显示。
可以用otherw.orderOut(self)
代替otherw.close()
感谢@Willeke
参考:如何隐藏窗口
学习好!