Initializing another window using storyboard for OS X

前端 未结 4 1649
春和景丽
春和景丽 2021-02-02 09:46

I have created a Cocoa application in Xcode6 which uses storyboards. As a template, Xcode provides a window for the application. I want to add a second window to show when the p

4条回答
  •  滥情空心
    2021-02-02 10:05

    swift 4 version :

    var monitorcontroler: NSWindowController!
    
    override init() {
        super.init()
    
        let mainStoryboard = NSStoryboard.init(name: NSStoryboard.Name(rawValue: "Main"), bundle: nil)
        monitorcontroler = mainStoryboard.instantiateController(withIdentifier: NSStoryboard.SceneIdentifier(rawValue: "moniteur")) as! NSWindowController
        monitorcontroler.showWindow(self)
    }
    

提交回复
热议问题