Re: NSDocument
Re: NSDocument
- Subject: Re: NSDocument
- From: Charles Jenkins <email@hidden>
- Date: Thu, 14 Jan 2010 16:34:16 -0500
I'm a noob, but I'm gonna give my interpretation anyway and let the
experts have a chance to correct my misunderstanding.
I think Matt means that if you use IB to look at your MyDocument.nib (or
.xib), in the window where you see File's Owner and other stuff, you
should NOT see another NSObject whose Class is set to 'MyDocument'. If
you have that, then your app will instantiate MyDocument, which will
load the NIB file, which will instantiate another MyDocument--and
weirdness ensues.
On 2010-01-14 16:19, David Blanton wrote:
Thank you for commenting but now I am really confused. When a project
is created from the document based template it contains files
MyDocument.h and MyDocument.m which define the interface and
implementation for a class MyDocument that inherits from NSDocument.
Whne built and and run if any one of many init methods are implemented
and awakeFromNib is implemented these are called.
So, I do not understand what you have said.
- db
On Jan 14, 2010, at 1:53 PM, Matt Neuburg wrote:
On Thu, 14 Jan 2010 12:57:57 -0700, David Blanton
<email@hidden>
said:
When my document based app starts up the awakeFromNib method in my
NSDocument subclass is called.
When I choose Open a new NSDocument is instanced but this does not
call awakeFromNib.
Am I missing a setting?
I need awakeFromNib to be called for any instance on my NSDocument
sublass.
I am in dire straits on this on, any help ...appreciated.
In a standard doc-based app, there is no NSDocument instance in the
nib. So
naturally no NSDocument instance ever awakes from a nib. So naturally
awakeFromNib is never called. The fact that your NSDocument subclass's
awakeFromNib is *ever* called suggests that you have already done
something
very odd.
Of course I could just be confused, but it sounds to me like you
might be
asking the wrong question. Is the question how to perform
initializations as
a document is opened? The Document-Based Applications Overview
contains a
discussion of this question.
m.
--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
http://www.tidbits.com/matt/default.html#applescriptthings
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden