Apple Doc2–Tools for iPhone OS Development

Tools for iPhone OS Development

Xcode is Apple’s suite of development tools that provide support for project management, code editing, building executables, source-level debugging, source-code repository(存贮) management, performance tuning, and much more. At the center of this suite is the Xcode application itself, which provides the basic source-code development environment. Xcode is not the only tool you use though, and the following sections provide an introduction to the applications you use to create iPhone applications.


The focus of your development experiences is the Xcode application. Xcode is an integrated development environment (IDE) that provides all of the tools you need to create and manage your iPhone projects and source files, build your code into an executable, and run and debug your code either in iPhone simulator or on a device.

To create a new iPhone application, you start by creating a new project in Xcode. A project manages all of the information associated with your application, including the source files, build settings, and rules needed to put all of the pieces together. The heart of every Xcode project is the project window, shown in Figure 1.

This window provides quick access to all of the key elements of your application. The Groups and Files list is where you manage the files in your project. The toolbar provides access to commonly used tools and commands while the details pane provides a configurable space for working on your project. Other aspects(Status bar) of the project window provide you with contextual information about your project.

Figure 1  An Xcode project window

An Xcode project window

Xcode comes with an advanced text editor, which supports features such as code completion, syntax coloring, code folding (to hide code blocks temporarily), and inline annotations for errors, warnings, and notes. If you need documentation, the Research Assistant provides context-sensitive documentation while the Xcode documentation window lets you browse and search for information.

When you build your application in Xcode, you have a choice of building it for iPhone simulator or for a device. The simulator provides a local environment for testing your applications to make sure they behave essentially the way you want. After you are satisfied with your application’s basic behavior, you can tell Xcode to build it and run it on an iPhone or iPod touch connected to your computer. Running on a device provides the ultimate test environment, and Xcode lets you attach the built-in debugger to the code running on the device.

Figure 2  Running a project from Xcode

Running a project from Xcode

For details on how to build and run your project on iPhone OS, see iPhone Development Guide.

Interface Builder

Interface Builder is the tool you use to assemble your application’s user interface visually. Using Interface Builder, you assemble your application’s window by dragging and dropping preconfigured(organized) components onto it. The components include standard system controls such as switches, text fields, and buttons, and also custom views to represent the views your application provides. After you’ve placed the components on the window’s surface, you can position them by dragging them around, configure their attributes using the inspector, and establish the relationships between those objects and your code. When your interface looks the way you want it, you save the contents to a nib file, which is a custom resource file format.

Figure 3  Designing your interface with Interface Builder

Designing your interface with Interface Builder

The nib files you create in Interface Builder contain all the information that the UI Kit needs to recreate the same objects in your application at runtime. Loading a nib file creates runtime versions of all the objects stored in the file, configuring them exactly as they were in Interface Builder. It also uses the connection information you specified to establish connections between the newly created objects and any existing objects in your application. These connections provide your code with pointers to the nib-file objects and also provide the information the objects themselves need to communicate user actions to your code.

Overall, using Interface Builder saves a tremendous amount of time when it comes to creating your application’s user interface. Interface Builder eliminates the custom code needed to create, configure, and position the objects that make up your interface.

For information on how to use Interface Builder, see Interface Builder User Guide.


To ensure that you deliver the best user experience for your software, the Instruments environment lets you analyze the performance of your iPhone applications while running in the simulator or on a device. Instruments gathers data from your running application and presents that data in a graphical display called the timeline. You can gather data about your application’s memory usage, disk activity, network activity, and graphics performance. The timeline view can display all of the different types of information side by side, letting you correlate the overall behavior of your application, not just the behavior in one specific area. To get even more detailed information, you can also view the detailed samples that Instruments gathers.

Figure 4  Using Instruments to tune your application

Using Instruments to tune your application

In addition to providing the timeline view, Instruments provides tools to help you analyze your application’s behavior over time. For example, the Instruments window lets you store data from multiple runs so that you can see whether your application’s behavior is actually improving or whether it still needs work. You can save the data from these runs in an Instruments document and open them at any time.

For details on how to use Instruments with iPhone applications, see iPhone Development Guide. For general information on how to use Instruments, see Instruments User Guide.

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s