How to do it? I simply want to load a window and show it in front of the main window.
NSWindowController* controller = [[NSWindowController alloc] initWithWindowNibName: @"MyWindow"];
NSWindow* myWindow = [controller window];
[myWindow makeKeyAndOrderFront: nil];
This code shows the window for one moment and then hides it. IMHO this is because I don’t keep reference to the window (I use ARC). [NSApp runModalForWindow: myWindow]; works perfectly but I don’t need to show it modally.
Yes, with ARC if you don’t hold a reference to the window it will be torn down as soon you as you exit the routine you were in. You need to hold a strong reference to it in an ivar.
[NSApp runModalForWindow: myWindow]is different because theNSApplicationobject holds a reference to the window as long as it is being run modally.