Information Technology Reference
In-Depth Information
Because there are so many differences between the two platforms, there's no simple automatic way to convert an
iPhone project into an iPad app. However, Xcode includes a minimal transitioning feature that can help you be-
gin the conversion process.
The converter relies on the fact that iPad and iPhone apps load different nib files at launch. It takes an existing
iPhone launch nib and creates a new launch nib from it for the iPad. This is enough to create a basic universal
app that runs on both platforms.
NOTE
The Window-based template creates two separate app delegate files and two starting nibs. Converted iPhone apps
also have two nibs, but the main window is controlled by a single shared app delegate which remains unaltered.
This is usually easier to work with; app management code is shared, not duplicated. Similarly, it's possible to cre-
ate a single shared controller that's aware of which platform it's running on. This is more efficient than creating
two controllers with similar code.
The best time to convert an app is when it's finished. Figure 8.21 shows a dummy iPhone app UI that stands in
for a finished app for this demonstration. You can start with an existing app of your own, or you can load any of
the templates. The exact contents of the app don't matter.
In this example there are two nib files. One defines the main window, and the other defines the UI and also in-
stantiates the view controller.
FIGURE 8.21
Getting ready to convert an iPhone app to the iPad
Search WWH ::




Custom Search