• 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: Matt Neuburg <email@hidden>
  • Date: Wed, 16 Aug 2006 10:11:55 -0700
  • Thread-topic: NSDocument open/new file problem when model object instance is in nib.

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.

--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
<http://www.amazon.com/gp/product/0596102119>



 _______________________________________________
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: NSDocument open/new file problem when model object instance is in nib.
      • From: joe OneNinetyTwo <email@hidden>
  • Prev by Date: Re: Multi-Array Sorting Problem
  • Next by Date: Re: Custom Cell not working in NSTableView
  • Previous by thread: Re: newbie : cocoa bindings - dot separated key path question
  • Next by thread: Re: NSDocument open/new file problem when model object instance is in nib.
  • Index(es):
    • Date
    • Thread