Graphics Programs Reference
In-Depth Information
Universalizing Homepwner
Open
Homepwner.xcodeproj
and select the
Homepwner
project from the project nav-
igator. Then select the
Homepwner
target in the editor area. In the
Summary
pane, change
the
Devices
pop-up to
Universal
(
Figure 13.2
).
Figure 13.2 Universalizing Homepwner
That was it.
Homepwner
now runs natively on the iPad. Click on the
Scheme
pop-up but-
ton next to the Run button. You'll see that there is now an
iPad Simulator
option. Select
this option and build and run the application.
The
ItemsViewController
view looks great on the iPad, but if you select a row,
you'll see that the
DetailViewController
's interface could use some work. (Also,
tapping the button to take a picture throws an exception. We'll fix this shortly.)
One way to improve the looks of the
DetailViewController
's interface on the iPad
is to change the autoresizing masks of the subviews in
DetailViewController.xib
so that when its view is resized to fit the iPad, all of the subviews are organized nicely. This
is what you did when you universalized your
HeavyRotation
application.
Another way is to create two completely independent XIB files: one for the iPhone device
family and the other for the iPad. This is most useful when you want to have a different in-
terface on the iPad that takes advantage of the additional screen space. To do this, you
name the iPad-specific XIB file the same as the iPhone version with an added
~ipad
suf-
fix, like
DetailViewController~ipad.xib
. Remember to recreate the entire view
hierarchy and re-establish connections in the iPad version of the XIB file.
When you create separate XIB files for the two device families and use the
~ipad
suffix,
you do not need to write any extra code to load the appropriate XIB file. Every