Re: KVO / NSArrayController question
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