Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Key-Value-Observing and Collections



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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.