Information Technology Reference
In-Depth Information
The four anchor tags around the outside of the autosizing box fix the pixel distance of each edge of an object
from its container. The two autosizing arrows inside the box control whether the object's dimensions change.
For some applications, you may need to set these to create more complex behaviors—for example, to lock an
item to the bottom-right corner of a window so it stays in position when the window is resized.
TIP
In Xcode 3, IB had a useful orientation preview feature. You could rotate a view in IB to check for correct align-
ment. This option has gone from Xcode 4. However, you can simulate by using the Editor Simulate Document
menu option in Xcode. This loads the nib into an iPhone or iPad Simulator window, without compiling the code.
You can check rotation with the Simulator's Hardware Rotate Right/Left menu options.
To finish the UI, double-click the button and set the text to CHANGE IT. Optionally, you can experiment fur-
ther with the alignment features. The button's attributes are more complex than a label's and there are more op-
tions to experiment with. For example, you can replace the default graphic with a custom image by importing
an image file into the project and selecting it in the Background drop-down menu. For a full guide, see the
UIButton Class Reference in the documentation. This example uses the button as is.
The finished UI is shown in Figure 7.23. The layout is complete, but it isn't yet linked to active code.
Note that although the design process can seem complex when you encounter it for the first time, it soon be-
comes more straightforward. With practice, you'll find that it becomes automatic. After you master the features
of the different Inspector panes in the Utility Area, you've made a good start with IB.
FIGURE 7.23
The finished UI, before it's linked to active code
Search WWH ::




Custom Search