• 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: Chris Hanson <email@hidden>
  • Date: Sat, 7 Oct 2006 21:06:18 -0700

On Oct 7, 2006, at 3:37 PM, Matteo Rossi wrote:

ank 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.

What I would probably do in your situation is add support to the drawing view for bindings, and bind it to the appropriate key in my array controller.


For performance, I would probably cache the information that the view receives in its observer notifications, so I don't need to either issue fetches or access the bound controller from within my view's - drawRect: implementation.

What all this would get me is the ability to completely decouple my view/drawing code from my model and controller code. This would make my view a lot more reusable, or at least able to be enhanced in such a way that it could be.

  -- Chris

_______________________________________________
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: mmalc crawford <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>)
 >Re: NSArrayController vs. fetch (From: Matteo Rossi <email@hidden>)

  • Prev by Date: filterPredicate binding following relationship in keypath
  • Next by Date: Re: NSArrayController vs. fetch
  • Previous by thread: Re: NSArrayController vs. fetch
  • Next by thread: Re: NSArrayController vs. fetch
  • Index(es):
    • Date
    • Thread