• 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: NSArrayController vs. fetch
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSArrayController vs. fetch


  • Subject: Re: NSArrayController vs. fetch
  • From: Matteo Rossi <email@hidden>
  • Date: Sun, 8 Oct 2006 00:37:21 +0200


What the array controller contains (and the value of arrangedObjects) is determined by the setting of 'automaticallyPreparesContent' and the filterPredicate. It is not determined by the table view.

Assuming you're only using a single managed object context and only one application is updating the store, then setting automaticallyPreparesContent to YES means that the array controller keeps itself up-to-date with insertions and deletions -- this is described in <http://developer.apple.com/documentation/Cocoa/ Reference/ApplicationKit/Classes/NSArrayController_Class/Reference/ Reference.html#//apple_ref/occ/instm/NSArrayController/ setAutomaticallyPreparesContent:>.
Thank you for your help. I think I've found the solution. I manage CD lines and use a NSArrayController to modify their properties in an information panel. When I draw a new line, I add it programmatically by using [initWithEntity: insertIntoManagedObject] and send a notification to update my drawing view. My problem was that if I tried to retrieve all lines in drawRect: by usign [myArrayController arrangedObjects] I didn't succeed to retrieve the last one I had drawn. I think it's due to the fact that the object graph is updated once per cycle and NOT NECESSARILY before drawRect was called. My first workaround was to execute a fetch. But I've found that the correct way is to invoke [moc processPendingChanges]. Thank you again, 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


  • Follow-Ups:
    • Re: NSArrayController vs. fetch
      • From: Chris Hanson <email@hidden>
References: 
 >NSArrayController vs. fetch (From: Matteo Rossi <email@hidden>)
 >Re: NSArrayController vs. fetch (From: mmalc crawford <email@hidden>)
 >Re: NSArrayController vs. fetch (From: Matteo Rossi <email@hidden>)
 >Re: NSArrayController vs. fetch (From: mmalc crawford <email@hidden>)

  • Prev by Date: Re: FSAllocateFork
  • Next by Date: Dynamic Instance Variables, is id the answer?
  • Previous by thread: Re: NSArrayController vs. fetch
  • Next by thread: Re: NSArrayController vs. fetch
  • Index(es):
    • Date
    • Thread