Information Technology Reference
In-Depth Information
FIGURE 13.30
Creating a new build phase begins with an empty custom script. Note that the input and output directories are
taken from the build settings and filled in for you.
CAUTION
Rearranging build phases can create nonsensical results; for example, placing the compile phase after the link
phase is rarely useful.
Creating a simple example of a build phase
It's often useful to copy extra resources such as a font file to a bundle. Both OS X and iOS can access fonts from
an application bundle. You can use this feature to guarantee that your choice of fonts is available to your app.
While it's possible to add fonts using the standard Add Files… option in Xcode, a custom build phase gives you
control over your app bundle's folder structure. You can use a build phase to copy items from any location in
your Mac to a folder inside the app.
Figure 13.31 shows one example of a Copy Files build phase. The settings shown in the figure create a folder
called /fonts inside the app bundle's /Resources folder, and copy a font file to it from a shared project art
directory. The Destination pop-up menu gives you more other powerful choices, including an absolute path op-
tion that can install resources to any disk location on a Mac.
FIGURE 13.31
Using a Copy Files build phase to add a font resource to a project.
Search WWH ::




Custom Search