Last week I spent a good amount of time fiddling around with the following problem. I solved it but since I couldn't find an answer here and I want to share my solution for anybody who runs into this.
Problem: My application runs in the background (menubar) and its main NSWindow
contains all the preferences of my application. You close the NSWindow
by clicking the close button in the top-left. After closing the NSWindow
and reopening it, all the NSControl
s were not visually responding. The actions worked accordingly, but they where not updating.
I tried the following:
NSWindow
NSWindow
from NIBNSControl
sNSControl
sNSView
sNSControl
(Worked for NSControl
, but was way too much work to use it for each and every one)NSControl
sI'll post my solution below for the records.
My solution to this problem was to subclass NSWindow
and overwrite the following methods:
- (void)performClose:(id)sender{
[self orderOut:nil];
}
- (void)close{
[self orderOut:nil];
}
Now the NSWindow
is hidden / ordered out and you just have to order it back in when displaying it.