簡體   English   中英

Xcode Swift MacOs - 隱藏/顯示 windows 沒有 Z1BC4A1B743127BBF1ED2E36F8

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM