• 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
Observing NSArrayController's content, shouldn't it be simple ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Observing NSArrayController's content, shouldn't it be simple ?


  • Subject: Observing NSArrayController's content, shouldn't it be simple ?
  • From: Yann Bizeul <email@hidden>
  • Date: Mon, 7 May 2007 10:06:19 +0200

Hello list.

Again, fighting with KVO and CoreData.

Say an NSArrayController A in my nib, which contentSet is bound to another NSArrayController B controller key:"selection", key path "myRelation"

What I want to do is quite simple, I just want to register as an observer for A's content, and get added/removed values.

So I do register like this :
[A addObserver:self forKeyPath:@"content" options: NSKeyValueObservingOptionNew|NSKeyValueObservingOptionOld context:nil];


And I'm listening like this :

- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id) object change:(NSDictionary *)change context:(void *)context
{
NSLog(@"%@",change);
}


But all I get each time I add an object is :
{kind = 1; new = <null>; old = <null>; }

I also tried :
[A addObserver:self forKeyPath:@"arrangedObjects" options: NSKeyValueObservingOptionNew|NSKeyValueObservingOptionOld context:nil];


Without more success...

The ONLY thing that seem to work is binding to the parent NSArrayController :

[[B selection] addObserver:self forKeyPath:@"myRelation.arrangedObjects" options: NSKeyValueObservingOptionNew|NSKeyValueObservingOptionOld context:nil];

This is ok, but NOT :
[B addObserver:self forKeyPath:@"selection.myRelation.arrangedObjects" options: NSKeyValueObservingOptionNew|NSKeyValueObservingOptionOld context:nil];


Well, If someone understand my problem I would be glad to grab a hand on this !

Thank you

Yann Bizeul - yann at tynsoe.org
Cocoa Developer

Tynsoe Projects
BuddyPop - GeekTool - SSH Tunnel Manager - ...
http://projects.tynsoe.org/


_______________________________________________

Cocoa-dev mailing list (email@hidden)

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: Observing NSArrayController's content, shouldn't it be simple ?
      • From: Chris Hanson <email@hidden>
    • Re: Observing NSArrayController's content, shouldn't it be simple ?
      • From: George Orthwein <email@hidden>
  • Prev by Date: Re: NSTreeController selection not updating
  • Next by Date: Core Data Entities in NSArray
  • Previous by thread: Re: NSTreeController selection not updating
  • Next by thread: Re: Observing NSArrayController's content, shouldn't it be simple ?
  • Index(es):
    • Date
    • Thread