• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Key-Value-Observing and Collections
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Key-Value-Observing and Collections
      • From: David Spooner <email@hidden>
    • Re: Key-Value-Observing and Collections
      • From: "David Symonds" <email@hidden>
  • Prev by Date: Re: Troublesome app when scaling it up, how to proceed?
  • Next by Date: Re: Key-Value-Observing and Collections
  • Previous by thread: Re: NSLocalizedString and plural form
  • Next by thread: Re: Key-Value-Observing and Collections
  • Index(es):
    • Date
    • Thread