Database Reference
In-Depth Information
Figure 31—Outline view of recipes
names for relationships between objects, and I normally implement accessors
instead of making my relationships generic. For instance, if we had a recipe
that has children named
RecipeIngredients
, I would add another accessor to that
relationship called
children
, purely for the
NSOutlineView
to use. We discuss custom
NSManagedObject
classes in
Chapter 1,
Under the Hood of Core Data
, on page 1
.
Unlike its parent object,
NSTableView
, the
NSOutlineView
does not work as cleanly
as we might expect. We can combine it with the
NSTreeController
, but we get a
lot more functionality and control by implementing the data source protocol
for the
NSOutlineView
instead of using the
NSTreeController
object.
NSTreeController
As discussed in
NSOutlineView
, on page 148
,
NSTreeController
objects are primar-
ily used by the
NSOutlineView
interface element. Although they can store any
data that lends itself to a tree structure, they are best suited as a controller
for
NSOutlineView
objects. Unfortunately, there is still quite a bit of work to be
done with the
NSTreeController
, and the results we get from working with it can
be unexpected and unclear. Therefore, I recommend skipping it at this time
and implementing the data source protocol instead when working with tree
data.
NSSearchField
The
NSSearchField
interface element is an extremely useful tool and can provide
an extra bit of polish to an interface. Its primary purpose is to filter the objects
in an
NSArrayController
. That may not seem like much, until we remember that,