Reputation: 22939
I am using an NSWindowController
not I want to set some attributes (specifically the styleMask
property) on the window, before the actual window is shown. However, the window
property on the NSWindowController
is only available once the window is already on screen.
I could use initWithWindow:
on the NSWindowController
but then I am no longer able to use a nib file for the content of the window (because this uses initWithWindowNibName:
.
So how can I configure the view before it is shown, something similar to viewWillAppear
on NSView
?
Upvotes: 2
Views: 889
Reputation:
In Interface Builder, uncheck the ‘Visible At Launch’ attribute. When doing this, the window is not shown when the corresponding nib file is loaded by the window controller, so you can configure your window in -[NSWindowController windowDidLoad]
and then manually show it using -[NSWindowController showWindow:]
.
Note that there’s no -viewWillAppear
method in Cocoa.
Upvotes: 3