NSWindowController Autosave using Storyboard

前端 未结 3 1393
一整个雨季
一整个雨季 2021-02-13 05:08

I have a Swift application that is launching a simple NSWindow, like so:

func applicationDidFinishLaunching(notification: NSNotification!) {
    let         


        
3条回答
  •  渐次进展
    2021-02-13 05:37

    This seems to be an Xcode bug. I was able to workaround it by manually setting the NSWindowController windowFrameAutosaveName property:

    windowController?.windowFrameAutosaveName = "Main App Window"

    However... This only worked for me if the property was set to a different value than what is displayed in Interface Builder. If it's programmatically set to the same value that's being used in IB, it doesn't work.

    So in IB the autosave name is left to MainAppWindow, and programmatically it's set to Main App Window.

提交回复
热议问题