Game Development Reference
In-Depth Information
In Figure
2-14
, we see the XIB file with an additional
UIView
objects added. To add a new component,
you simply drag it from the lower right box, either to the Objects list or directly onto the scene in the
middle. In this case, we added two
UIView
objects named Landscape and Portrait as siblings to the
UIView
named View (A). Collectively, we will refer to these two
UIView
objects as the orientation views.
On each of these new
UIView
objects we added a
UILabel
by dragging it from the library at the lower
right into the visual representation in the middle of the screen (B). The text for each label will identify
which view we are currently displaying. To make sure our layout is correct, the size of the Landscape
and Portrait
UIView
objects is set in the properties panel to the right (C). In the center of the screen,
you can see the Landscape
UIView
displayed over the Portrait
UIView
(D).
The next step is to add a new
UIView
to each orientation view. This new
UIView
will describe where
our Rock, Paper, Scissors game will be displayed. Figure
2-15
shows this new
UIView
added to the
Portrait orientation view.
Figure 2-15.
Holder views added to the iPhone's XIB file
In Figure
2-15
, we see that we have added two new
UIView
objects to the XIB file. The first one is
called Portrait Holder View (A), and the second is called Landscape Holder View. In the center of the
screen (B), we see that Portrait Holder View is 300x300 (C) points in size and a darker color (red).
Landscape Holder View is a subview of Landscape (not shown).