chapter seven

Laying Out Your Scenes and Views

Interface Builder Lets you draw your interface easily. As noted, you can avoid Interface Builder if you want: you can create and manage all of your interface elements programmatically. There are many drawbacks to that approach—a significant one of them is that, when you use Interface Builder to build your interface, the files that you build—xib files—are actually composed of XML (you normally don’t see it, but it’s there). Because your interface files are text-based, you can search them using the Search navigator in some cases. Also you can use the Edit⇒Refactor command to rename some of the elements just as you would rename a method or class.

Yet another significant benefit of using Interface Builder to build your interface is that, as you use a graphical interface, you are going to experience some of the same joys and frustrations that your users will experience. You can become the usability test lab and keep track of what works for you and what doesn’t.

Laying out your scenes and views with a graphical user interface makes a great deal of sense: you can place interface elements just where you want them to be shown. Alignment guides prompt you to easily align the elements. The system by which this has been accomplished is very powerful, but it does have some limitations. In OS X 10.7 and iOS 6, Auto Layout was introduced to make things easier.

The layout tools that have been used in the past mostly let you manage the size and ...

Get iOS 6 Foundations 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.