Key-Value-Observing and Collections
Key-Value-Observing and Collections
- Subject: Key-Value-Observing and Collections
- From: Philip Mötteli <email@hidden>
- Date: Thu, 25 Oct 2007 15:23:05 +0200
Hi,
There is something, I just don't get with KVO. Lets say, I have an
object
@interface Pupil
{
NSMutableArray grades;
}
- (void)setGrades:(NSMutableArray *)theGrades;
- (NSMutableArray *)grades;
- (void)addGrade:(Grade *)aGrade;
@end
Using KVO, I want to be notified not only, when the old grades
collection object (NSMutableArray) is replaced, but also, when a
Grade instance is added to the grades collection (something like
"[grades addObject:aGrade]").
The first case is easy, because I know the attribute name (grades),
which gives the key. But for the second, I don't know the attribute
name, so I can't add an observer.
Can anybody explain me how to do this?
Thanks
Phil
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden