• 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: NSDocument open/new file problem when model object instance is in nib.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSDocument open/new file problem when model object instance is in nib.


  • Subject: Re: NSDocument open/new file problem when model object instance is in nib.
  • From: joe OneNinetyTwo <email@hidden>
  • Date: Wed, 16 Aug 2006 17:42:18 -0700 (PDT)

--- Matt Neuburg <email@hidden> wrote:

> On Tue, 15 Aug 2006 14:22:47 -0700 (PDT), joe
> OneNinetyTwo
> <email@hidden> said:
> >I have an instance of my model object inside
> >MyDocument.nib.
> >
> >This instance is the content for an
> >NSObjectController, which, in turn, is bound to two
> >NSArrayControllers, which are bound to two
> >NSTableViews of two NSArrays inside my model
> object.
> >
> >The corresponding model object inside MyDocument.m
> via
> >IBOutlet is connected to the model object instance
> >inside the nib.
> >
> > When I create a New document, the window
> controller
> >opens the nib, unarchives the model instance, and
> sets
> >it as the model object inside MyDocument object.
> >
> >Now, here's my problem.   If I open a file, then
> >loadDataRepresentation unarchives the coded model
> >object saved in the file, and then the window
> >controller opens the nib, unarchives the model
> >instance in the nib, and sets it as the model
> object
> >inside MyDocument object.    The model object that
> was
> >in my file gets released and deallocated, and I'm
> >looking at a new document window.
> >
> >If I remove the model object instance from the nib,
> >then I lose the content for the ObjectController.
> >
> >Any suggestions on how I can solve this problem?
>
> When you open a file, and loadDataRepresentation
> unarchives the coded model
> object, retain it off in an ivar. Then in
> windowControllerDidLoadNib, fix
> the problem. This is SOP. m.

I thought of that, but didn't try it.    In the
meantime, I instead realized I could eliminate the
model object instance from the nib, and, set the
controller content in code

	[dataSetController setContent:dataSet];

where dataSet is my model object (instantiated in code
instead of the nib).   I don't know why this worked,
but setting the Controller content to the FileOwner in
the nib didn't work.   Aren't they equivalent?








__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
 _______________________________________________
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

References: 
 >Re: NSDocument open/new file problem when model object instance is in nib. (From: Matt Neuburg <email@hidden>)

  • Prev by Date: Re: newbie : cocoa bindings - dot separated key path question
  • Next by Date: Dynamic support of image file formats
  • Previous by thread: Re: NSDocument open/new file problem when model object instance is in nib.
  • Next by thread: [JOB] Mac Developers Wanted
  • Index(es):
    • Date
    • Thread