views:

828

answers:

2

Hey all,

I have a HUD window that has some labels on it, and I want this to show when the user presses a button. I know this is simple, but I can't get it to show again unless I restart my program.

Sincerely,

Kevin

+4  A: 

To hide hudWindow:

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
    [hudWindow orderOut:nil]; // to hide it
}

Then on button press:

- (IBAction)showWindow:(id)sender {
    [hudWindow makeKeyAndOrderFront:nil]; // to show it
}
Scott G
You don't need to hide the window programmatically on launch, you should just uncheck the "Visible at launch" checkbox in Interface Builder.
Rob Keniger
for this should I make an outlet? and the should the type be NSPanel?
Kevin
+3  A: 

In IB, go to the window's attributes inspector and make sure that "Released when closed" isn't checked.

NSResponder