[baseten-users] to-many relationship set observing
Tuukka Norri
tuukka.norri at karppinen.fi
Mon May 4 18:33:52 EEST 2009
Hi!
Réjean Lamy kirjoitti 4.5.2009 kello 14.40:
> Is it possible to observe add/remove to a to-many relationship's
> set ?
Yes, just call BXDatabaseObject's -
addObserver:forKeyPath:options:context: with the relationship's name
as the key. Here's a small example (Department is the relationship's
name):
// Add the observer somewhere.
[object addObserver: self forKeyPath: @"Department" options: 0
context: kObservingContext];
- (void) observeValueForKeyPath: (NSString *) keyPath ofObject: (id)
object change: (NSDictionary *) change context: (void *) context
{
if (kObservingContext == context)
{
// Handle the change.
...
}
else
{
[super observeValueForKeyPath: keyPath ofObject: object
change: change context: context];
}
}
--
Best regards,
Tuukka Norri
MK&C
More information about the baseten-users
mailing list