Re: Programmatically Open NSDocument Based Window.
Re: Programmatically Open NSDocument Based Window.
- Subject: Re: Programmatically Open NSDocument Based Window.
- From: Felix Franz <email@hidden>
- Date: Thu, 27 Jan 2011 15:19:46 +0100
On 27.01.2011, at 14:54, Bruce Cresanta wrote:
> Hello,
>
> I am trying to open an NSDocument based window. My NSDocument class follows the standard (MyDocument) class created using the automatic project settings. I do initialization in the awakeFromNib override within MyDocument.
>
> To create the document I use:
>
> id myDocument = [[NSDocumentController sharedDocumentController] makeUntitledDocumentOfType:@"DocumentType" error:&error];
>
> The awakeFromNib initializations ARE SKIPPED in this call.
According to the documentation this method creates a new document by calling initWithType:error: in the NSDocument
subclass. Use NSDocumentController#openUntitledDocumentAndDisplay:error: and set the displayDocument parameter to YES.
In your NSDocument subclass you should override windowControllerDidLoadNib: but I guess awakeFromNib will work fine ...
<http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/Documents/Articles/ObjectInteractions.html#//apple_ref/doc/uid/TP40003196-SW2> shows the sequence for creating a new document
Cheers,
felix
_______________________________________________
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