Open New Window in Swift

后端 未结 1 816
天涯浪人
天涯浪人 2021-01-02 20:26

I am trying to open a new window in my Swift application but I cannot get it to open.

class AppDelegate: NSObject, NSApplicationDelegate 
{
    func applicat         


        
相关标签:
1条回答
  • 2021-01-02 20:40

    After the openMyWindow() method is executed, the windowController will be released and consequently the window is nil. That's why it is not there.

    You have to hold the window in you class to keep it alive, then the window will be visible.

    var windowController : NSWindowController?
    
    0 讨论(0)
提交回复
热议问题