One Quickie


Observing using KVO (Bindings->General)
Register an observer with something like:
    [searchArrayController addObserver: self
                           forKeyPath: @"selectionIndexes"
                           options: NSKeyValueObservingOptionNew
                           context: NULL];
This makes self an observer of the searchArrayController. We'll get notified when the selectionIndexes value changes, and we'll be notified with the new value.

When the notification happens, this method (invoked against the self used earlier) is invoked:

- (void) observeValueForKeyPath: (NSString *) keyPath
                       ofObject: (id) object
                         change: (NSDictionary *) change
                        context: (void *) context
{
} // observeValueForKeyPath
and you can poke around the arguments to see wha'happened.



borkware home | products | miniblog | rants | quickies | cocoaheads
Advanced Mac OS X Programming book

webmonster@borkware.com