• 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: Sharing instances between NIB's?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Sharing instances between NIB's?


  • Subject: Re: Sharing instances between NIB's?
  • From: mmalcolm crawford <email@hidden>
  • Date: Tue, 17 May 2005 12:08:28 -0700


On May 17, 2005, at 11:34 AM, Timothy Reaves wrote:
It is my understanding that if I simply drag the header of the object
to the NIB window, and instantiate it, that will instantiate a new
instance. Whereas this isn't a concern from a resource utilization
standpoint, I'm not sure if it is the best from a design standpoint.
So I figured I'd ask people with more experience than I.


You should typically only instantiate controller objects directly in a nib like this. You generally shouldn't instantiate model objects (whether Core Data or otherwise) in the nib.

     So if I have a NIB with an ObjectController instance on it, what
method would I call to set the instance of the CoreData object it is
to control.

Either setContent:, or -- depending on the rest of your architecture -- bind the contentObject to the relevant keypath. (You will also have to set or bind the managed object context for the controller.)


Then, is it beast to put a new instance of my AppDeligate in the
subsequent NIBs, or create some other class that holds a reference to
the managedObjectContext.
To date, when I've needed to share objects between NIBs, I've created
an AppController instance per NIB, then put outlets in the
AppController. I then have one controller instantiate an other, and
set the outlet. I'm wanting to get others opinion as to whether this
is the most effective way to do this.


This sounds "unusual". There is typically only one App delegate. It's also not clear why you would have more than one "AppController"? Again this sounds like it has little to do with Core Data per se and more to do with fundamental application architecture. What are you trying to achieve?

mmalc

_______________________________________________
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: Sharing instances between NIB's? (From: "Timothy Reaves" <email@hidden>)

  • Prev by Date: Javabeans in Cocoa/ObjC?
  • Next by Date: NSTextfield updating values but not clearing values with bindings
  • Previous by thread: Re: Sharing instances between NIB's?
  • Next by thread: File Size wrong on connected computer
  • Index(es):
    • Date
    • Thread