Chapter 8: Creating More Advanced Effects with Interface Builder
Creating outlets and actions is a key step in application design with Interface Builder (IB). More complex applications require more advanced skills, which are discussed in this chapter.
Working with Constraints
If you change the form factor of the iPhone version of the IB project created in Chapter 7, by switching between the 3.5” and 4” Simulator views or by rotating the display, you’ll see that the button is no longer centered vertically. When you place objects using IB’s guidelines, the positions are static. They’re not responsive—they don’t keep track of the form factor and screen rotation and rearrange themselves automatically.
Figure 8.1 shows what happens when you rotate the layout in the Simulator when starting with a simplified version of the IB project UI from Chapter 7. Both objects keep their relative alignments but lose their overall alignment to the center line.
The main view works like a window into the UI. If you rotate the UI, the objects don’t move inside it. If you change the widths of either object, you’ll see they don’t keep their horizontal alignment either.
Get Xcode 5 Developer Reference 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.