On Oct 10, 2010, at 5:54 AM, Trygve Inda wrote:

> I have a controller object with an ivar "myDict"
> 
> I have a nib with an NSArrayController bound to this object with a keypath
> of mydi...@allvalues
> 
> This works, but when I want to add an item to the dict (and have it
> reflected in the arraycontroller), the method in my object is:
> 
> [self willChangeValueForKey:@"myDict"];
> 
> NSDictionary*  test =
> [NSDictionary dictionaryWithObjectsAndKeys:@"someValue", @"someKey", nil];
> 
> [myDict setValue:test forKey:@"someOtherKey"];
> 
> [self didChangeValueForKey:@"myDict"];
> 
> 
> This works too, but how can I do this without the willChange/didChange ?
> 
> Shoudln't the setValue call, fire a KVO message?

NSDictionary does not emit any notices when the collection itself is mutated, 
or when keys change. Have you tried using an NSDictionaryController instead?

HTH,

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to