I need something like a “tag”(iOS) for cocoa NSWindow. I have an “Error Message” NSWindow. I use the same window to display many custom messages. The problem is that if I release the window, this closes, so I need to keep a reference to the window in a NSDictionary, and in the close action, I am going to release the corresponding error window.
ErrorWindow *controllerWindow = [[ErrorWindow alloc] initWithWindowNibName:@"ErrorWindow"];
[controllerWindow showWindow:self];
[controllerWindow setMessageText: message];
[controllerWindow setInformationText:info];
//If I release the window, it closes.
[controllerWindow release];
You may want to subclass NSWindow, so you can add your tag property:
In InterfaceBuilder, you’ll then be able to set the class of your windows to MyWindow, instead of NSWindow.