• 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
KVO with Proxy Classes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

KVO with Proxy Classes


  • Subject: KVO with Proxy Classes
  • From: Mike Rossetti <email@hidden>
  • Date: Wed, 2 Feb 2005 21:53:31 -0700

Hello Cocoaholics,

Imagine Window A with a list of people. Select a person and press the Edit button and Window B is presented with details about the selected person. Changing the person's name and tabbing to the next field causes the person's name in the list in Window A to update.

This is all being done with bindings. Window A has an array controller wired to the data model. Window B has an object controller wired to the window's data source.

Everything works fine when my data model is based on an NSMutableArray (people) which contains NSObjects (a person). That is, typing a change in the name in Window B and tabbing causes Window A to update immediately.

But when I turn the NSMutableArray into a proxy (i.e. I intercept count, objectAtIndex:, etc. and manage the data out of a secondary object (in this case vector<person>)) and provide an ephemeral proxy object to provide the KVC/KVO interface (an NSObject subclass with forwarding functions such as setPersonName, getPersonName)...

...the result is that a change in the name in Window B (the person edit window) is only reflected in Window A after closing Window B.

I tried wrapping the name changing code within setPersonName in willChangeValueForKey:/didChangeValueForKey: but that made no difference.

I suspect that the creation of these person proxy objects only when needed may break some link between the person edit controller and the observed.

Any thoughts on the matter would be most appreciated.

Thanks,
Mike
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: KVO with Proxy Classes
      • From: Mike Rossetti <email@hidden>
  • Prev by Date: Re: Method not seeing array as array
  • Next by Date: Re: Method not seeing array as array
  • Previous by thread: new .Mac SDK v1.1 bug?
  • Next by thread: Re: KVO with Proxy Classes
  • Index(es):
    • Date
    • Thread