Graphics Programs Reference
In-Depth Information
There is another type of object in a XIB file: placeholder objects . There are two objects in
this XIB file in the Placeholder section: File's Owner and First Responder . You can safely
ignore the First Responder , but the File's Owner is very important.
To understand the File's Owner , you must first understand the need for it. When a view
controller loads its view, it sets its view property so that it knows what its view is and can
put it on the screen. For the HypnosisViewController , we did this programmatic-
ally, so it was done in loadView and all set at compile time.
Not so with TimeViewController . When an instance of TimeViewController
needs to load its view , it will load the XIB file. When this happens, all of the archived
objects in the XIB will be created, and TimeViewController can't know which of
those objects is its view .
Here's where the File's Owner comes in: the File's Owner is a hole in the XIB file. You
make connections between objects in the XIB and File's Owner when configuring the in-
terface. When the XIB file is loaded, the TimeViewController drops itself in the
File's Owner hole, and all the connections between the File's Owner and the archived ob-
jects will be made to the TimeViewController .
To be able to set the connections that a TimeViewController needs, we have to tell
Xcode that TimeViewController is the class of the object that will drop itself into
the hole. Select the File's Owner object on the outline view and click the icon in the in-
spector area to show the identity inspector. Change the Class to TimeViewControl-
ler ( Figure 7.9 ).
Figure 7.9 Identity inspector for File's Owner
 
Search WWH ::




Custom Search