Chapter 7. Nib Management

The term nib file, or simply nib, has nothing to do with fountain pens or bits of chocolate; it originated as an acronym for “NeXTStep Interface Builder”, which was used for the .nib file extension. Just about any iOS app you create will contain at least one nib file. This file will be generated from either a .xib file or a .storyboard file in your Xcode project (see Chapter 6). When you edit a .xib or .storyboard file in Xcode, you appear to be in a drawing program; it looks as if you’re designing a piece of interface graphically, much as you might create and edit a drawing in Adobe Illustrator, OmniGraffle, Canvas, or any of a host of other similar drawing applications past and present. I’ll refer to this aspect of Xcode’s editing environment as the nib editor.


Up through Xcode 3.2.x, nib editing was performed in a separate application, Interface Builder. Starting in Xcode 4, the functionality of Interface Builder was rolled into Xcode itself. Nevertheless, the nib editor environment within Xcode is still often referred to as Interface Builder.

When you work in the nib editor, you’re not really creating a drawing. You’re encoding instructions for instantiating, initializing, and configuring objects. As I said in Chapter 5 (see especially Nib-Based Instantiation), when you drag a button into a view in the nib editor, put that button into a certain position, give it a certain size, and double-click it and set its title to “Howdy!”, you’re putting instructions ...

Get iOS 7 Programming Fundamentals now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.