简体   繁体   English

Xcode Swift MacOs - 隐藏/显示 windows 没有 Z1BC4A1B743127BBF1ED2E36F8

[英]Xcode Swift MacOs - Hide/Show windows without a StoryBoard and without ViewController

I'm making an App on my Apple macOS computer by using Swift 3我正在使用 Swift 3 在我的 Apple macOS 计算机上制作应用程序

Close a window is eazy [in this way] from my main window called w by clicking button and calling the function closeotherw()通过单击按钮并调用w closeotherw()从我的主要 window 关闭 window 很容易 [以这种方式]

@IBOutlet var w: NSWindow!
@IBOutlet var otherw: NSWindow!
    @IBOutlet var otherw: NSPanel!
    @IBAction func closeotherw(_ sender: AnyObject) {
        otherw.close()
    }

But how to reopen-it [otherwin]?但是如何重新打开它[otherwin]?

I also tried it in all ways, also like w.isHidden = true but with no results.我也以各种方式尝试过,也像w.isHidden = true但没有结果。

I don't have a StoryBoard and I also don't have a ViewController .我没有StoryBoard也没有ViewController

I'm doing all from AppDelegate .我正在从AppDelegate做所有事情。

Method is: otherw.orderFront(self)方法是: otherw.orderFront(self)

Also there is:还有:

makeKeyAndOrderFront to show it again. makeKeyAndOrderFront 再次显示它。

You can use otherw.orderOut(self) instead otherw.close()您可以使用otherw.orderOut(self)代替otherw.close()

tnks to @Willeke tnks 到@Willeke

reference: How to hide the window参考: 如何隐藏 window

Good learning!好好学习!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 目前ViewController Segue Transition没有故事板[Swift] - Present ViewController Segue Transition Without Storyboard [Swift] Swift 5. 如何在按钮触摸时呈现或显示 ViewController? 没有故事板(以编程方式) - Swift 5. How present or show ViewController on button touch? Without Storyboard (programmatically) 推送没有 storyboard 的 ViewController - push ViewController without storyboard Swift 4.2:如何在 ViewController 中嵌入 UIPageControl(没有 Storyboard)? - Swift 4.2: How to embed UIPageControl in ViewController (without Storyboard)? 以编程方式将NavigationController添加到指定viewController中,而无需故事板快速 - Add navigationController to specif viewController programmatically without storyboard swift 显示 viewController 并在没有 storyboard 和 segue 编程的情况下传递数据 - Show viewController and pass data without storyboard and segue programming 如何在didSelectItemAt indexPath函数下显示ViewController? (没有情节提要) - How to show ViewController under the didSelectItemAt indexPath function ? (without storyboard) 没有情节提要的Swift SWRevealController - Swift SWRevealController without storyboard 没有故事板的 Swift 委托 - Swift delegation without storyboard 没有prepareForSegue的Swift ViewController - Swift ViewController without prepareForSegue
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM