How does NSArrayController know?
How does NSArrayController know?
- Subject: How does NSArrayController know?
- From: Bob Ueland <email@hidden>
- Date: Fri, 5 Oct 2007 00:03:51 -0700 (PDT)
The following quote is from chapter 7 of Aaron's book.
"You plan to store the array inside MyDocument and to set the NSArrayController's contentArray binding so as to tell it to use MyDocument's array as its content. You will also write two methods that will be called when NSArrayController wishes to insert or remove a Person object.
Open MyDocument.h and add two instance variables and two actions:
@interface MyDocument : NSDocument
{
IBOutlet NSArrayController *personController;
NSMutableArray *employees;
}
- (void)insertObject:(Person *)p inEmployeesAtIndex:(int)index;
- (void)removeObjectFromEmployeesAtIndex:(int)index;
- (void)setEmployees:(NSMutableArray *)array
@end
"
Later he says "the two methods in MyDocument will be called automatically to insert and remove Person objects from the employees array."
My question is how the NSArrayController knows the method names insertObject:inEmployeesAtIndex: and removeObjectFromEmployeesAtIndex: (the word employees is chosen by our app and the general class NSArrayController can't possible know that).
I've looked at "NSArrayController Class Reference" but couldn't find any info. I suspected kvc compliance but the document never mentions it (or I missed it).
Bob
____________________________________________________________________________________
Don't let your dream ride pass you by. Make it a reality with Yahoo! Autos.
http://autos.yahoo.com/index.html
_______________________________________________
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