mattdwen
mattdwen

Reputation: 5428

Hide a window in cocoa from awakeFromNib

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

I only want one of the windows visible on launch. Insdide awakeFromNib I am using:

[windowMain orderOut:self];

which is having no effect. However, if I try:

[windowMain setTitle:@"Renamed Title"];

It works as expected. Thoughts?

Upvotes: 3

Views: 4435

Answers (2)

hollow7
hollow7

Reputation: 1506

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

Upvotes: 2

thesamet
thesamet

Reputation: 6582

Look for the "Visible At Launch" property in the attributes inspector for the window in Interface Builder.

Upvotes: 10

Related Questions