• 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: Minimal document-based app
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Minimal document-based app


  • Subject: Re: Minimal document-based app
  • From: "email@hidden" <email@hidden>
  • Date: Tue, 01 May 2012 10:25:48 +0100


On 29 Apr 2012, at 22:47, ecir hana wrote:

> Dear list,
>
> I'm trying to understand how the things in Cocoa works but I'm
> struggling with one thing. I saw
> http://cocoawithlove.com/2010/09/minimalist-cocoa-programming.html and
> http://casperbhansen.wordpress.com/2010/08/15/dev-tip-nibless-development/
> and I think I somewhat understood.
>
> Now, I would like to do the same but for a "Document-based
> application". Please, does anyone know of a tutorial or example akin
> to the ones above? Alternatively, what do I need to do to make it
> work? I think I need to create NSDocumentController - but how does it
> relate to NSApplication? And I create NSDocument from there? Frankly,
> I'm bit lost…
I appreciate the intention here.
I would start by creating a NSDocumentBased app using the Xcode template and examining it.
This app is fully functional even though it contains just the document class and the nib.
The reason it works can be found in info.plist under CFBundleDocumentTypes.
This defines the NSDocument class to use.

In MainMenu.xib you can see that File New sends newDocument: up the responder chain.
This passes up the chain to NSApplication which (having loaded Info.plist) knows to create an instance of your document class.
To create a document in code just send newDocument: up the responder chain with a nil targeted action
[NSApplication sendAction:@selector(newDocument:) to:nil from:self]

Regards

Jonathan Mitchell

_______________________________________________

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


  • Prev by Date: Re: Minimal document-based app
  • Next by Date: Nil and nil Macro Conflict
  • Previous by thread: Re: Minimal document-based app
  • Next by thread: Nil and nil Macro Conflict
  • Index(es):
    • Date
    • Thread