• 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: David Hirsch <email@hidden>
  • Date: Wed, 02 Dec 2009 09:43:00 -0800

Thanks, Quincey-
That did indeed solve the problem. Are there docs (other than the official ones, which in this particular area are inscrutable to me) that discuss this idea of a proxy? I'd like to know more on this topic, so as to avoid similar problems in the future.
-Dave


On Dec 2, 2009, at 4:17 AM, Quincey Morris wrote:

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: Quincey Morris <email@hidden>
    • Re: Key path help for complex binding
      • From: Ken Thomases <email@hidden>
References: 
 >Key path help for complex binding (From: David Hirsch <email@hidden>)
 >Re: Key path help for complex binding (From: Quincey Morris <email@hidden>)

  • Prev by Date: Re: Migrating changed objects between contexts
  • Next by Date: Re: Migrating changed objects between contexts
  • Previous by thread: Re: Key path help for complex binding
  • Next by thread: Re: Key path help for complex binding
  • Index(es):
    • Date
    • Thread