Re: Getting hold of an NSView from an NSDocument
Re: Getting hold of an NSView from an NSDocument
- Subject: Re: Getting hold of an NSView from an NSDocument
- From: Bob Savage <email@hidden>
- Date: Mon, 11 Feb 2002 01:02:40 -0600
on 2/10/02 8:29 PM, Michael P. Rogers wrote:
>
I created an NSView subclass
...
>
Now, however, I'm trying to use it in an NSDocument application. So,
>
I create an EtchASketch in the nib file (well, I drag a CustomView
>
and then indicate that it's an EtchASketch). MyDocument has an
>
IBOutlet called etchy, and I use IB to make the connection.
>
>
However, that connection doesn't seem to "last". If I close my
>
window, then make a new one, etchy is nil.
It is not clear to me what this means. Which window are you closing? The one
in IB? If you close the *Document* window then the view is going to go away.
To what are you connecting the view? To a subclass of NSDocument -- which
will go away when you close the window, but which will be created afresh
with each new document window (and with it a new instance of the EtchASketch
view)? Or to something that outlasts the window and therefore the view?
>
So, is it correct to say
>
that when I load a new nib file, I'm really loading a whole new set
>
of objects, so the connection I make in IB isn't relevant?
The connection you make in IB is very relevant, however it is *also* true
that every nib loaded is a new set of objects.
>
And in this same vein, *can* I load a new MyDocument, and then
>
programatically tell it where the EtchASketch object is?
Yeah, but there is no reason to do so from your description.
>
I'm allegedly lecturing on this in a few hours, so I hope that
>
well-rested Cocoa programmers on the other side of the world will
>
kindly help me out on this :-)
I'm not sure if Tennessee counts as "the other side of the world", but ...
Bob :)
_______________________________________________
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.