swift - Open window from menu -
how can open new window xib file in swift2? i've created new nswindowcontroller + xib, can't find how open it?
@ibaction func openpreferences(sender: nsmenuitem) { let wc = settingsviewcontroller() //... }
i've decided use custom storyboard instead of xib nsview. here code.
appdelegate.swift:
class appdelegate: nsobject, nsapplicationdelegate { lazy var settingscontroller: nswindowcontroller? = nsstoryboard(name: "settingsstoryboard", bundle: nil).instantiatecontrollerwithidentifier("settingswc") as? nswindowcontroller @ibaction func openpreferences(sender: nsmenuitem) { if let controller = settingscontroller { controller.showwindow(self) } } }
Comments
Post a Comment