• 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: KVO / NSArrayController question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: KVO / NSArrayController question


  • Subject: Re: KVO / NSArrayController question
  • From: Scott Stevenson <email@hidden>
  • Date: Tue, 4 Jan 2005 12:00:32 -0800


On Jan 4, 2005, at 10:09 AM, Peter Schols wrote:

I'd be interested in every possible keyPath available so I was wondering if there is a simpler approach of observing all keyPaths at once for all objects in the array managed by NSArrayController

You can't do all keypaths at once, but you can bulk process the array objects:


id path, e = [keyPaths objectEnumerator]; // assume keyPaths and items exists

NSRange indexesRange = NSMakeRange ( 0, [items count] );
id indexes = [[NSIndexSet alloc] initWithIndexesInRange: indexesRange ];


while (path = [e nextObject])
{
[items addObserver: self toObjectsAtIndexes: indexes forKeyPath: path options:NULL];
}


Another option is to make up a fake key like @"allKeysPlaceholder" and make it dependent on every other key. Then you only have to subscribe to @"allKeysPlaceholder".


- Scott

--
http://treehouseideas.com/
http://theocacao.com/ [blog]
 _______________________________________________
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: 
 >KVO / NSArrayController question (From: Peter Schols <email@hidden>)

  • Prev by Date: NSTextView replaceCharactersInRange performance and thread safety
  • Next by Date: Re: NSTextView replaceCharactersInRange performance and thread safety
  • Previous by thread: KVO / NSArrayController question
  • Next by thread: NaN (Not a Number) Error using Bindings
  • Index(es):
    • Date
    • Thread