On Thu, 15 Nov 2012 16:19:53 -0800, Rick Mann said:

>I know I can use KVO on a specific property of my NSManagedObject, but
>is there a way to get notified if any property changes? I'm trying to
>avoid a bunch of -addObserver:… and -removeObserer:… calls.

You could create a dependent key, that depends on all your keys of interest, 
then you just observe that one key.  Like:

+ (NSSet*)keyPathsForValuesAffectingValueForKey:(NSString*)inKey
{
        NSSet* set = [super keyPathsForValuesAffectingValueForKey:inKey];
        if ([inKey isEqualToString:@"everything"])
        {
                set = [set setByAddingObjectsFromSet:[NSSet setWithObjects:
                                                                                
          @"firstName",
                                                                                
          @"lastName",
                                                                                
          @"age",
                                                                                
          nil]];
        }
        
        return set;
}

Cheers,

-- 
____________________________________________________________
Sean McBride, B. Eng                 s...@rogue-research.com
Rogue Research                        www.rogue-research.com 
Mac Software Developer              Montréal, Québec, Canada

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to