Re: Key path help for complex binding
Re: Key path help for complex binding
- Subject: Re: Key path help for complex binding
- From: Quincey Morris <email@hidden>
- Date: Wed, 2 Dec 2009 04:17:51 -0800
On Dec 1, 2009, at 16:19, David Hirsch wrote:
> The problem is, when I add a new Room to the master rooms array, and then add that room to the roomCosts array of each Course's roomConstraint, the table column doesn't get updated, until I tweak it manually (by adding a new course). It is still bound to the existing items in the rooms array - if I alter their name, that get observed and reflected in the table, but adding new ones does not get observed.
...
> @implementation CourseRoomConstraint
> - (void) addRoom:(Room *) newRoom {
> [roomCosts addObject:[[RoomCost alloc] initWithRoom:newRoom]];
> }
It *looks* like the problem is that you're not adding the RoomCost object KVO-compliantly. Instead of just adding objects to a NSMutableArray, you should add them to a KVO-compliant mutable array proxy, something like this:
NSMutableArray* mutableRoomCosts = [self mutableArrayValueForKey: "roomCosts"];
[mutableRoomCosts addObject: ... etc ];
_______________________________________________
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