Hide cocoa window by awakeFromNib

I have a NIB with two NSWindow objects. The controller class has two IBOutlets, one for each NSWindow (windowLogin and windowMain).

I need only one window visible at startup. Insdide awakeFromNib I use:

[windowMain orderOut:self];

which has no effect. However, if I try:

[windowMain setTitle:@"Renamed Title"];

It works as expected. Thoughts?

+3
source share
2 answers

Find the Visible At Launch property in the attribute inspector for the window in Interface Builder.

+10
source

Alternatively, in ApplicationDidFinishLoading you can call [window setIsVisible: NO]

+2
source

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


All Articles