Version: 1.0

Posted: 2007-02-23

Build Requirements: Xcode MacOSX10.4u.sdk

Runtime Requirements: Mac OS X 10.4 Tiger

View Source Code:

Download Sample (“TwoManyControllers.zip”, 202.9K)
Download Sample (“TwoManyControllers.dmg”, 266.1K)



Description

This sample demonstrates how NSArrayControllers can be used to produce a user interface that traverses multiple (in this case two) to-many relationships. The basic model consists of a Product with a to-many relationship to a Version which in turn has a to-many relationship to a License. That is, a product has many versions, and a version has many licenses.

In this example, we would like the user to be able to select a single Product and display all the Licenses associated with that Product. To accomplish this we use an intermediate NSArrayController that holds an array of all the Versions associated with the selected Product. We then populate the Licenses NSArrayController with the distinct set of objects returned from asking every Version object in the Versions Array Controller (the arrangedObjects) for its Licenses key path.

Document Revision History

Date Notes
2007-02-23How to use an intermediate NSArrayController to populate an NSTableView across two to-many relationships.

Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.