Database Reference
In-Depth Information
Figure 29—
NSNumberFormatter
Attributes inspector
Once an
NSFormatter
has been applied to an object, it can be a little tricky to
reference it again to make changes. To change or remove an
NSFormatter
once
it has been applied, select the number formatter in the element list on the
left side of the Interface Builder view. Selecting the line item references the
NSFormatter
again so that it can be manipulated. See
Figure 30,
Accessing an
existing NSFormatter on an element
, on page 148
.
8.4
Other Interface Elements That Use KVO, KVC, and Core Data
Although the previous sections show how to access the Core Data repository
in our recipe application with KVO and KVC, let's quickly review the other
elements that, if we wanted or needed to, could be utilized to display the data
in our application as well.
NSObjectController
NSObjectController
shares a lot of similarities with the
NSArrayController
discussed
earlier. However, unlike the
NSArrayController
, the
NSObjectController
is designed to
represent
one
instance rather than an array of instances. A common usage
of the
NSObjectController
is to represent the selected object of an
NSArrayController
,
thereby making it clearer as to what data is being displayed in the interface
elements that are bound to the
NSObjectController
, as opposed to an
NSArrayController
.
Another common usage is to have an entire interface, such as a detail sheet
or child window, be bound to the values within an
NSObjectController
and then
have the File's Owner reference and populate that
NSObjectController
. In this
design, the File's Owner (usually a subclass of
NSWindowController
) simply has
to populate the
NSObjectController
with a call to
-setContent:
, and the entire
UI
is