• 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: Binding of invisible controls: is lazy data loading possible?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Binding of invisible controls: is lazy data loading possible?


  • Subject: Re: Binding of invisible controls: is lazy data loading possible?
  • From: Quincey Morris <email@hidden>
  • Date: Mon, 19 Jan 2009 13:27:18 -0800

On Jan 19, 2009, at 12:11, Vitaly Ovchinnikov wrote:

I cache those data, but when I change something that affects them, I
need to reset the cache. And to let everyone know that something
changed, I call -will/didChangeValueForKey for my property. And
controller immediately call this property even if grid is not visible.

This sounds like the relevant issue. If you call will/ didChangeValueForKey for a *collection* property, observers of the property (the array controller and, indirectly, the grid, in this case) must assume that everything has changed.


The solution is to *not* call will/didChangeValueForKey, which often indicates a poor coding solution anyway. Instead, update your data model KVO compliantly. This means:

1. If some change affects a cached object's properties, update it KVO compliantly. (Use setters to change its properties, or use keyPathsForValuesAffecting<Key> class methods to indicate which keys its properties depend on, and update *those* keys KVO compliantly.)

2. If some change affects which objects are cached, update the cache array KVO-compliantly. (Use standard NSMutableArray methods on [yourCacheOwner mutableArrayValueForKey: @"yourCacheArray"] instead of yourCacheArray.) That will let the array controller know just what changed, and allow it to be selective about what it queries as a result.




_______________________________________________

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: Binding of invisible controls: is lazy data loading possible?
      • From: Ken Thomases <email@hidden>
References: 
 >Binding of invisible controls: is lazy data loading possible? (From: "Vitaly Ovchinnikov" <email@hidden>)

  • Prev by Date: Re: NSPredicateEditorRowTemplate for NSDate
  • Next by Date: Re: NSPredicateEditorRowTemplate for NSDate
  • Previous by thread: Binding of invisible controls: is lazy data loading possible?
  • Next by thread: Re: Binding of invisible controls: is lazy data loading possible?
  • Index(es):
    • Date
    • Thread