• 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: addObserver:forKeyPath:options:context
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: addObserver:forKeyPath:options:context


  • Subject: Re: addObserver:forKeyPath:options:context
  • From: Eric Long <email@hidden>
  • Date: Tue, 18 Apr 2006 09:43:17 -0700

> added a dummy "isDirty" attribute to my class and
> in the initialize method of this class set it to generate change
> notifications for isDirty when any of the attributes I am really
> interested in changes;
>
> [self setKeys:[NSArray arrayWithObjects:@"_frameColor",
> @"_frameTransparency", @"_fillColor", @"_fillTransparency",
> @"_captionColor", @"_captionTransparency", @"_captionPosition", nil]
> triggerChangeNotificationsForDependentKey:@"_attribsChanged"];

Yeah, I'm kind of wondering what the overhead on this gets to be like when
you have a few thousand items.

In my case, I decided to set my +/- actions to call my methods, which then
call the NSArrayController methods for adding/removing.  So I see it happen
and can set isDirty.  I also use the controlTextDidChange() delegate methods
so I see edits and can follow those changes.  Seems a lot less expensive and
it works for my case.

Someone else mentioned an NSArray(KeyValueObserving) method:
addObserver:toObjectsAtIndexes:forKeyPath:options:context:


Eric


 _______________________________________________
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

References: 
 >Re: addObserver:forKeyPath:options:context (From: Herbert Putteneers <email@hidden>)

  • Prev by Date: Re: C# to Objective-C translator?
  • Next by Date: Re: Comparing NSEntityDescription instances?
  • Previous by thread: Re: addObserver:forKeyPath:options:context
  • Next by thread: Different context in Core Data
  • Index(es):
    • Date
    • Thread