The problem of the "Settings" window (after opening and closing, it will not open again)

The problem is that when the settings window opens and closes, it does not open again. Why is this happening and how can this be fixed?

EDIT: They just noticed that I have the same problem with the Main Window.

The window opens through the menu bar and is located in a separate NIB file.

+4
source share
4 answers

It looks like you forgot to install the “window” outlet of your window controller (in Nib, File Owner) to point to your window. As soon as you connect its “window”, the showWindow: window controller will work.

+8
source

It's hard to say without seeing the code, but one of the possibilities is that you have “Release When Closed” that was set for the window in Interface Builder, and you download it once, cache it, and then expect that you can close and re-open it without loading the thread again.

+3
source

For any other noobs like me having this problem :)

Remember to set the file owner class to the same as the controller class, then you can connect the window output to the panel.

+2
source

I encountered the same problem while working on chapters 12 (Nib Files and NSWindowController) in Aaron Hillegass Cocoa for Mac OS X. The Doug answer above was the solution - I did not link the window of the owner of the Preferences.xib file to the window itself (in this case the Panel window (Preferences)).

I right-clicked on “File Owner” in the Preferences.xib file, then left-clicked the mouse from the window into the (Preferences) panel. After execution and rebuilding, the application worked as intended. I could close and reopen the user settings panel, and my previous settings were still there (since the settings window was not unloaded, it was just hidden).

+1
source

All Articles