![](/img/trans.png)
[英]Present ViewController Segue Transition Without Storyboard [Swift]
[英]Xcode Swift MacOs - Hide/Show windows without a StoryBoard and without ViewController
我正在使用 Swift 3 在我的 Apple macOS 計算機上制作應用程序
通過單擊按鈕並調用w
closeotherw()
從我的主要 window 關閉 window 很容易 [以這種方式]
@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()
tnks 到@Willeke
參考: 如何隱藏 window
好好學習!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.