Chapter 12. Using Interface Builder
This chapter covers
- Learning how Interface Builder works
- Writing a simple program using the interface
- Linking Interface Builder and Xcode
In the last chapter, you built a labeledwebview class that included both a label and a web view. As is typically the case with programmatic design, you had to crunch numbers to make sure all your objects fit correctly on the screen.
What if you didn’t have to do that? What if you could lay out objects using a graphical design program and then immediately start using them in Xcode? With the SDK, you can, thanks to Interface Builder.
As we write this, Apple doesn’t offer any extensive iPhone Interface Builder documentation. The “Interface Builder User Guide” contains some good information, but it’s still more desktop-centric than we’d like. If you need more information than we provide here, you might still want to read that document, because it does have some iPhone specifics.
Because we consider Interface Builder to be an alternative to Xcode (in appropriate situations), our exploration of it will mirror the structure of last chapter’s look at Xcode. We’ll give an overview of the program, and then we’ll put together a simple first project using it. Afterward, we’ll explore a more complex but fundamental technology—connecting Interface Builder to Xcode. Finally, we’ll briefly touch upon other functionality.
With all that said, what exactly is Interface Builder, and how does it work?