• 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
NSArrayController, CoreData and bindings
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSArrayController, CoreData and bindings


  • Subject: NSArrayController, CoreData and bindings
  • From: Marcus Roberts <email@hidden>
  • Date: Fri, 13 May 2005 20:08:23 +0100

Hi,

I'm still experimenting with Core Data, and have another newbie problem.

I created a very simple NSPersistentDocument based application, with a
single entity called Task.  I dragged that into the document main
window in IB and used Many Objects to build the test interface.  All
that works fine.  What's key is the creation of NSArrayController
which is what the default table is bound to, and the controller is
bound to the managedObjectContext.

What I'm trying to do is have a NSView that draws content depending on
the data in the NSArrayController, rather than fetching the data from
the managed object context myself.  But I can't work out when the
NSArrayController is populated.  I created a subclass of NSView that
overrides awakeFromNib, and reports back the number of
arrangedObjects:

NSLog(@"entries in array: %d",[[arraycontroller arrangedObjects] count]);

arraycontroller is an IBOutlet that is connected to the array
controller in the nib.

When the application runs, it awakes from nib with a reply of 0
entries, which I would expect.  But when I load a saved document which
has entries in it, it still reports 0.

This is a simplified test case - I have a more complicated version of
the application, where I have a button connected to an action that
tells the view to redraw - when I click this, it does then find data
in the array controller and renders it properly.

So, my key question is when does an NSArrayController instantiated in
a nib have content when it's bound to a managedObjectContext?
awakeFromNib seems to early from my experiments.

Thanks

Marcus
 _______________________________________________
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

  • Prev by Date: Re: Where/how to store lots of user application data
  • Next by Date: Re: Where/how to store lots of user application data
  • Previous by thread: Re: Dressing Core Data In Drag ...
  • Next by thread: CoreData & NSTreeController question
  • Index(es):
    • Date
    • Thread