• 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: NSArrayController array-observation
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSArrayController array-observation


  • Subject: Re: NSArrayController array-observation
  • From: mmalcolm crawford <email@hidden>
  • Date: Wed, 3 Dec 2003 11:09:20 -0800

On Dec 3, 2003, at 9:07 AM, Dominik Wagner wrote:

Hmm, I started implementing this, and it wasn as much work as I initially thought. Things worth mentioning:
- The indexed Accessors for to-many propertys only get called if you don't have normal accessors (-<key>, -set<key>)

Not so, as you'll see if you add logging statements to:
<http://homepage.mac.com/mmalc/CocoaExamples/AddaYearWithArrayKVC.zip>
The "normal" get and set methods are called for getting and setting the whole array, but if you add or remove individual elements the appropriate indexed accessors are called.

- If you do not implement the indexed accessors, then although your returning a MutableArray in the -<key> accessor, the NSArrayController always set the whole array on change (addObject:)

Umm, yes. I think this has been covered beofre. From the header file:
- (id)valueForKey:(NSString *)key;
"Given a key that identifies a to-many relationship, return an immutable array that contains all of the related objects."

Since the array is treated as being immutable, if any modification is made to it the whole array is "replaced" if it's changed. The fundamental concept here is encapsulation, and preservation thereof. See also, though, - (NSMutableArray *)mutableArrayValueForKey:(NSString *)key;

mmalc
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: NSArrayController array-observation
      • From: Dominik Wagner <email@hidden>
References: 
 >Re: NSArrayController array-observation (From: Dominik Wagner <email@hidden>)

  • Prev by Date: Re: Creating small controls programmatically
  • Next by Date: Re: NSArrayController array-observation
  • Previous by thread: Re: NSArrayController array-observation
  • Next by thread: Re: NSArrayController array-observation
  • Index(es):
    • Date
    • Thread