• 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
Propagation of KVO through bindings
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Propagation of KVO through bindings


  • Subject: Propagation of KVO through bindings
  • From: "Hamish Allan" <email@hidden>
  • Date: Wed, 16 Apr 2008 16:49:35 +0200

Hi,

If I set up key-value observing of an NSArrayController's
arrangedObjects like so:

[myArrayController addObserver:self forKeyPath:@"arrangedObjects"
	options:(NSKeyValueObservingOptionOld|NSKeyValueObservingOptionNew)
context:nil];

I get informed when the array controller's content changes.

Now if I set up an extra level of indirection:

myDictionary = [[NSMutableDictionary alloc] init];
[myDictionary bind:@"boundArrangedObjects" toObject:myArrayController
	withKeyPath:@"arrangedObjects" options:nil];
[myDictionary addObserver:self forKeyPath:@"boundArrangedObjects"
	options:(NSKeyValueObservingOptionOld|NSKeyValueObservingOptionNew)
context:nil];

I would expect to be informed of the change twice, but though (if I
log its contents) myDictionary.array seems to be being kept up to
date, KVO is not informing me of the change through the binding.

Is this expected behaviour, and if so, is it possible to get the
notifications I want some other way?

Thanks,
Hamish

P.S. I have tried the array controller in both entity and class modes
and it seems to make no difference.
_______________________________________________

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: Propagation of KVO through bindings
      • From: "Hamish Allan" <email@hidden>
  • Prev by Date: Re: WebKit+AppleScript+JavaScript
  • Next by Date: Re: WebKit+AppleScript+JavaScript
  • Previous by thread: Re: NSDrawer resizing problem - no longer resizes when parent window resized
  • Next by thread: Re: Propagation of KVO through bindings
  • Index(es):
    • Date
    • Thread