• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Programmatically Open NSDocument Based Window.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >Programmatically Open NSDocument Based Window. (From: Bruce Cresanta <email@hidden>)

  • Prev by Date: Programmatically Open NSDocument Based Window.
  • Next by Date: Re: How to scale a TabBarItem Image
  • Previous by thread: Programmatically Open NSDocument Based Window.
  • Next by thread: Re: Programmatically Open NSDocument Based Window.
  • Index(es):
    • Date
    • Thread