• 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: Question about Saving a document
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question about Saving a document


  • Subject: Re: Question about Saving a document
  • From: Paul Lynch <email@hidden>
  • Date: Wed, 14 Jun 2006 21:45:53 +0100


On 14 Jun 2006, at 11:48, Francis Derive wrote:

On Jun 5, 2006, at 12:50 PM, Paul Lynch wrote:


On 5 Jun 2006, at 11:42, Francis Derive wrote:

My document nib has :
	- an instance of a simple model object,

You don't want to have your model instantiated in the nib, in general, although there are situations where it could be appropriate.

Paul,

You say "You don't want to have your model instantiated in the nib" but, in the Apple's "Developing Cocoa Applications Using Bindings: A Tutorial", this is what is made : an instance of the model named "Converter" is instanciated in the nib, then an instance of an NSObjectController - the content of which is the above model, etc...

You shouldn't assume that Apple examples all follow best practices (they try, but can't always succeed), nor that their examples are always entirely typical usages.


What could I do from a nib if there were nothing in it ?

This question indicates that you haven't understood the example very well. A nib will certainly contain many view objects (windows, buttons, fields, etc), as well as instantiated controllers, both bindings controllers and your own classes.


Your controller objects will interact with both view objects, and model objects. Most commonly, model objects are instantiated inside your controllers. In a few cases, and the CurrencyConverter is one, you can have a model object that is instantiated inside the nib, simply because it is convenient to do so. It isn't a very typical model object.

I would like a comment from you.

Now I keep these scheme from the tutorial, and I will ask how to extend the Cocoa bindings Tutorial so as to save such documents - through bindings : I tried but doesn't succeed and understand nothing.

You need to implement a connection from your document controller to the converter object, and refer to it in the load and save methods. See previous posts. However, there isn't any reasonable way to implement load functionality unless you move the converter object inside your controller, as you can't just replace the nib instantiated object. Again, see previous posts.


You aren't going to be able to simply "extend" this example; sometimes, you have to make changes to previous approaches into order to move forwards. Perhaps some of the Apple documentation people on this list will take your suggestion and update the tutorial for you.

Paul

A bientôt.


Francis

_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: Question about Saving a document
      • From: Francis Derive <email@hidden>
References: 
 >Question about Saving a document (From: Francis Derive <email@hidden>)
 >Re: Question about Saving a document (From: Paul Lynch <email@hidden>)
 >Re: Question about Saving a document (From: Francis Derive <email@hidden>)

  • Prev by Date: buttons with key equivalents in drawers
  • Next by Date: Re: Apple Data Plotting Framework
  • Previous by thread: Re: Question about Saving a document
  • Next by thread: Re: Question about Saving a document
  • Index(es):
    • Date
    • Thread