Re: Core Data notifications
Re: Core Data notifications
- Subject: Re: Core Data notifications
- From: Bill Cheeseman <email@hidden>
- Date: Sat, 08 Oct 2005 14:28:56 -0400
- Thread-topic: Core Data notifications
on 2005-10-08 10:21 AM, Bob Peterson at email@hidden wrote:
> When a new Program is created it needs to show up
> in Master.sources. Master observes
> NSManagedObjectContextObjectsDidChangeNotification and paws through
> the collections of added and deleted objects to see if any are
> Programs. If so, then it does
> [self willChangeValueForKey:@"countOfSources"];
> [self didChangeValueForKey:@"countOfSources"];
> This (A) bugs me since I can't send willChangeValueForKey -before-
> the managed object context is changed, and (B) my ArrayController
> doesn't update the display of sources.
>
> How am I going about this wrong?
I solved this problem by using -awakeFromInsert instead of observing
NSManagedObjectContextObjectsDidChangeNotification. I found that the
notification isn't observed until the next iteration of the run loop, which
is too late to update the display. -awakeFromInsert is invoked in the same
iteration.
--
Bill Cheeseman - email@hidden
Quechee Software, Quechee, Vermont, USA
http://www.quecheesoftware.com
PreFab Software - http://www.prefab.com/scripting.html
The AppleScript Sourcebook - http://www.AppleScriptSourcebook.com
Vermont Recipes - http://www.stepwise.com/Articles/VermontRecipes
_______________________________________________
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