On 9 May 2012, at 4:45 AM, ecir hana wrote:

> When I were doing this in Xcode, I would just connect
> the menu item to the first responder and the document from IB would receive
> the saveDocument:, right?

"the document from IB" worries me. Your NIB should not include an instance of 
your document (NSDocument-subclass) object. The NSDocument object gets created 
by the global NSDocumentController (see later in this message). The NSDocument 
is represented in the NIB as "File's Owner." An in-NIB NSDocument won't get 
patched into the responder chain, and will disrupt all the connections you make 
in the NIB.

> But there has to be a document controller, I
> imagine it is somehow "implied" or "implicit" as in not exposed to the
> user, which does the heavy lifting, do I understand this correctly? If so,
> what exactly does this document controller do?

You may be using the phrase "document controller" loosely. In a document-based 
application, there is one and only one instance of NSDocumentController (or a 
subclass). It handles the creation and destruction of NSDocument (subclass) 
objects. In the simplest case, an NSDocument is responsible for all the 
"controller" tasks (mediating between model and view), in the "MVC" sense, for 
a document and its views. But that's a different concept.

NSDocument objects are part of the responder chain, which is how they get 
action messages. In the Documentation organizer, search the Lion documentation 
for "responder chain," and select the result labeled "The Responder Chain." 
That should tell you everything you need to know.

        — F


-- 
Fritz Anderson -- Xcode 4 Unleashed: Due 21 May 2012 -- 
<http://x4u.manoverboard.org/>


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to