Hi
I am extending a library class which is also one of my application's model objects. The Library class contains an NSMutableArray of NSData which it absolutely needs to perform its tasks. To extend the class i must now also hold metadata about each NSData object in the array (i.e. the <item> elements in the array now becomes a pair or triple).

Conveniently the Hillegass example is similar. In RaisMan the person data is displayed in columns of TableView. (and i would like to have a tableview maybe also but thats not the point). I should create a new object called person.h that defines each element in the array and provides the accessor methods for binding to person.expectedRaise and person.Name. Then an NSArrayController can give an array for each column of the data. Another common method is to make an NSMutableArray of NSMutableDictionaries and then binding the dictionary @"key" to the arrayController. Either way achieves such a goal.

But here is the crux of my problem:
The library object (which encloses these array) must keep its interface which is a flat array of NSData (and as originally) is used on the api side.

Can i store internally the complicated array including the metadata and use an NSArrayController to expose only the original NSData part of each item?

In other words;
This would be equivalent to saying that person.Name == persons.person and person.expectedRaise is a calculated metadata about the person. If i wanted to use an array of persons in a payroll department object then i would initialise the department with an array of person names, and the payroll department would take care of figuring out what the expectedRaise should be for each person. Then the payroll department would need to have itself an NSArrayController to map an array of string objects taken by the initializer to the internal array of person objects.

Is anything special required to use the NSArrayController programmatically as i shall not be using Interface Builder?




_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to