Instance Method

initWithWindow:

Returns a window controller initialized with a given window.

Declaration

- (instancetype)initWithWindow:(NSWindow *)window;

Parameters

window

The window object to manage; can be nil.

Return Value

A newly initialized window controller.

Discussion

This method is the designated initializer for NSWindowController.

This initializer is useful when a window has been loaded but no window controller is assigned. The default initialization turns on cascading, sets the shouldCloseDocument property to NO, and sets the window frame autosave name to an empty string. As a side effect, the created window controller is added as an observer of the NSWindowWillCloseNotifications posted by that window object (which is handled by a private method). If you make the window controller a delegate of the window, you can implement NSWindow’s windowShouldClose: delegate method.

See Also

Initializing Window Controllers

- initWithWindowNibName:

Returns a window controller initialized with a nib file.

- initWithWindowNibName:owner:

Returns a window controller initialized with a nib file and a specified owner for that nib file.

- initWithWindowNibPath:owner:

Returns a window controller initialized with a nib file at an absolute path and a specified owner.