• 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
Re: Key path help for complex binding
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Key path help for complex binding
      • From: David Hirsch <email@hidden>
References: 
 >Key path help for complex binding (From: David Hirsch <email@hidden>)

  • Prev by Date: Modifying TableHeaderCell
  • Next by Date: Re: Download Alert -- Quarantine information removal
  • Previous by thread: Re: Key path help for complex binding
  • Next by thread: Re: Key path help for complex binding
  • Index(es):
    • Date
    • Thread