Graphics Programs Reference
In-Depth Information
Building Interfaces
Now you're going to create the user interface for Quiz using Xcode 's visual tool for build-
ing interfaces. In many GUI builders on other platforms, you describe what you want an
application to look like and then press a button to generate a bunch of code. Xcode 's inter-
face builder is different. It is an object editor: you create and configure view objects and
then save them into an archive. The archive is a XIB (pronounced “zib”) file.
A XIB file is an XML representation of the archived objects. When you build a project, the
XIB file is compiled into a NIB file. Developers work with XIB files (they're easier to
edit), and applications use NIB files (they're smaller and easier to parse). However, most
iOS developers use the words XIB and NIB interchangeably.
When you build an application, the compiled NIB file is copied into the application's
bundle . The bundle is a directory containing the application's executable and any resources
the executable uses.
When your application reads in, or loads, the NIB file from the bundle at runtime, the ob-
jects in the archive are brought to life. Your first application will have only one NIB file,
and it will be loaded when the application first launches. A complex application, however,
can have many NIB files that are loaded as they are needed.
In the project navigator, find and select the file named QuizViewController.xib .
When you open this (or any) XIB file from the project navigator, the editor area displays a
dock view and a canvas. The dock view is on the lefthand side of the editor area, and it
shows the objects in the XIB file. You can expand the dock view into an outline by clicking
the disclosure button in the bottom left corner of the canvas ( Figure 1.6 ). The dock shows
fewer details and is useful when screen real estate is running low. However, for learning
purposes, it is easier to see what is going on in the outline view.
Figure 1.6 Editing a XIB file in Xcode
 
Search WWH ::




Custom Search