Re: NSArrayController help
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.