Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hide and Show HUD Window - Cocoa?

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

like image 541
lab12 Avatar asked Nov 30 '22 11:11

lab12


2 Answers

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
}
like image 196
Scott Greenlay Avatar answered Dec 05 '22 01:12

Scott Greenlay


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

like image 21
NSResponder Avatar answered Dec 05 '22 02:12

NSResponder