• 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 help
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSArrayController help


  • Subject: Re: NSArrayController help
  • From: mmalcolm crawford <email@hidden>
  • Date: Sun, 2 Nov 2003 16:31:28 -0800

On Nov 2, 2003, at 1:11 PM, Scott Anguish wrote:

I guess I can subclass NSArrayController and so I can override addObject and set the year for the new item. Is the best way to do it? Thanks!
Another option would be to register as an observer of the contents of the array, and when an insertion takes place, you could then modify the object(s).

Or, in the object which provides the content array, implement the array accessors as described here:

<http://developer.apple.com/documentation/Cocoa/Conceptual/ KeyValueCoding/Concepts/AccessorConventions.html>

- (unsigned int)countOfStuffArray;
- (id)objectInStuffArrayAtIndex:(unsigned int)index;
- (void)insertObject:(id)anObject inStuffArrayAtIndex:(unsigned int)index;
- (void)removeObjectFromStuffArrayAtIndex:(unsigned int)index;

and update the object value in insertObject...

An example implementation is given here:

<http://homepage.mac.com/mmalc/CocoaExamples/AddaYearWithArrayKVC.zip>

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.

References: 
 >Re: NSArrayController help (From: Scott Anguish <email@hidden>)

  • Prev by Date: Linking to libcrypto
  • Next by Date: Re: Linking to libcrypto
  • Previous by thread: Re: NSArrayController help
  • Next by thread: Help find doc on error messages
  • Index(es):
    • Date
    • Thread