Re: awakeFromNib Called Twice
Re: awakeFromNib Called Twice
- Subject: Re: awakeFromNib Called Twice
- From: Quincey Morris <email@hidden>
- Date: Thu, 27 Jan 2011 17:28:53 -0800
On Jan 27, 2011, at 17:10, Bruce Cresanta wrote:
> I have an NSDocument instance in my IB! It was the only way I could hook up a connection to a controlView for the window that gets created for the document.
>
> Do you know a way to programmatically retrieve the controlView for the window that gets created for the document?
> This would enable me to forget IB altogether, which is not a problem because I'm using all custom controls written from scratch.
What's the NIB's File's Owner object? The document, or a window controller?
If the document, you can connect NIB objects directly to the File's Owner proxy. (Make sure you set it to the correct NSDocument subclass in IB's Identity panel.)
If the window controller, you should probably be doing all this stuff in the window controller instead. Note, though, that a window controller has a "document" property which allows you to get to the document through it.
If your controls are all custom code, they can find the document directly (as 'self.window.windowController.document'), provided that the controls have already been added to a view that's been already added to the window. You may not need to create any outlets at all.
_______________________________________________
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