Re: Where's the NSWindowController in a default document-based app
Re: Where's the NSWindowController in a default document-based app
- Subject: Re: Where's the NSWindowController in a default document-based app
- From: Izidor Jerebic <email@hidden>
- Date: Sun, 20 Jun 2004 09:18:12 +0200
On 20 Jun 2004, at 00:27, James DiPalma wrote:
On Jun 19, 2004, at 9:54 AM, Izidor Jerebic wrote:
On 18 Jun 2004, at 16:59, Glen Low wrote:
So where does the (default?) NSWindowController come into play?
In simple default single-window-document app, the NSDocument plays
the role of window controller, so there is no NSWindowController.
For many years I thought NSWindowController would get lost because it
gets allocated automatically and has no nib representation. Just
because you don't see an object, doesn't mean its not there (consider
NSDocumentController).
In an Xcode default "Cocoa Document-based Application", NSDocuments
use an NSWindowController to load their nib file. These window
controllers are allocated by -makeWindowControllers:
#0 0x92f017dc in -[NSWindowController initWithWindowNibName:owner:] ()
#1 0x930523b0 in -[NSDocument makeWindowControllers] ()
Yes, that is correct. But since NSDocument is made the owner of the
nib, it really does play the role of NSWindowController (handling the
GUI objects, having outlets, being the target for actions, etc.). The
code is significantly different when you have NSDocument-only app or
NSDocument with NSWindowController(s) app.
It was easier for me to grasp what is happening this way. Though
technically NSDocument internally allocates its NSWindowController, you
never see it and its existence does not affect your code (at least it
should not).
So in reality (heh!) there is a NSWindowController, but NSDocument
handles most of its duties, so for all practical views and purposes
NSDocument is NSWindowController in a simple app.
izidor
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.