Game Development Reference
In-Depth Information
Figure 12-8.
Overview of iPhone XIB file
In Figure
12-8
, we see the XIB file for the iPhone version of this game fully expanded. On the left, at
item A, we see a reference to the main
UIWindow
of the game, as well as a reference to the
AppDelegate
.
The view controller at item B is an instance of the class
RootViewController
, which is a subclass of
UINavigationController
. The view controller RootViewController is wired up to the Window so that it is
the root controller; this causes the
RootViewController's
top-level
UIViewController
to be displayed.
In short, everything is wired up so the view at item E is displayed at launch.
In Figure
12-8
, we see that there are two other
UIViewControllers: Extras Controller
at item C
and
Belt Commander Controller
at item D. The object
Extras Controller
corresponds to the view at
item G, while the object
BeltCommanderController
corresponds to the view at item G. Both of these
controllers have an
IBOutlet
in our class
RootViewController
so they can be referenced. In fact, many
of the objects in the XIB file are connected to the
RootViewController
, as shown in Listing 12-1.
Listing 12-1. RootViewController.m
@interface RootViewController : UINavigationController<BeltCommanderDelegate,
UIAlertViewDelegate, GKLeaderboardViewControllerDelegate>{
IBOutlet UIViewController* welcomeController;
IBOutlet BeltCommanderController* beltCommanderController;