Show NSWindow

Is there a way to check if a window is hidden and show NSWindow programmatically?

I tried [self showWindow: nil] and [self.window makeKeyAndOrderFront: self], but they cause wierd behavior, like, two windows, etc.

+4
source share
1 answer

Use - (BOOL) isVisible (so BOOL visible = [self.window isVisible] to determine if the window is hidden or not, and if you want to hide or show the window, use this: [self.window setHidden:YES] And, obviously , you pass NO to display it.

Edit

Sorry, use the - (void) setIsVisible:(BOOL) yourBOOL method instead of the setHidden method.

Hope I helped.

+3
source

Source: https://habr.com/ru/post/1438756/


All Articles