Skip navigation.
 
mlRe: Best way to get the window of an NSDocument?
FROM : Daniel Eggert
DATE : Thu Apr 28 10:28:47 2005

It's a Model-View-Controller thing. NSDocument is your model, the
window is your view. The model should not have references to the
controller or view, but it is the controller that references the model.
At least that is how see things.

Once you start having references both ways, you'll quickly end up
having retain cycles and other 'fun'.

/Daniel

On 24 Apr 2005, at 19:59, Marc Respass wrote:

> Hi,
>
> NSDocument doesn't have a -window method to get the window for my
> document. I believe it's possible to have multiple windows for a
> single document but in this case, I'm putting a toolbar on my window
> during -windowControllerDidLoadNib: so the document isn't even
> finished opening yet. I'm using this
>
> id myWindow = [self windowForSheet];
>
> which according to the docs, seems to be a good way to go about it. I
> just want to check on that. Is it a hack? Should I go through the
> process of asking the window controller for the right window?
>
> Thanks a lot
> Marc

Related mailsAuthorDate
mlBest way to get the window of an NSDocument? Marc Respass Apr 24, 19:59
mlRe: Best way to get the window of an NSDocument? Daniel Eggert Apr 28, 10:28
mlRe: Best way to get the window of an NSDocument? Marc Respass Apr 28, 21:15
mlRe: Best way to get the window of an NSDocument? mmalcolm crawford Apr 30, 02:08
mlRe: Best way to get the window of an NSDocument? Marc Respass Apr 30, 16:40