Information Technology Reference
In-Depth Information
Objects are drawn top down, which means that objects lower down the list in the IB object side panel at the left
cover objects higher up as they appear on the screen.
Use the reveal triangle at the bottom left to show the items in the view, and swap the position of the label and
the button. You'll see that the label covers the button in the UI editor.
FIGURE 7.32
Changing the order and position of the label and the button demonstrates what happens when one object covers
another in the hierarchy.
The objects in a nib file are arranged in a tree. Some objects, such as UIViews , can contain other objects. In
the example, the label and the button are both inside the main UIView . The structure is rather like a folder in
Finder. You can use reveal triangles to open and close objects, showing and hiding the objects inside them. An
object inside another appears indented in the list. When you change the physical position of an object in the
hierarchy, all the objects inside it move with it.
You could in theory add a separate UIView to the UI, resizing both to create a split UI with two panes. Some
commercial apps use this split format to create designs with multiple active areas that respond to the user in dif-
ferent ways. For example, a game might have a control panel with fixed buttons and a display area with anim-
ated scrolling graphics.
In complex apps, the hierarchy can become deep, with many objects. For example, Figure 7.33 shows the hier-
archy of a minimal OS X app. The nib includes a window, a view, and a deep hierarchy of menu items. You can
rearrange the menu headers and menu items by dragging them. For example, you can swap the position of the
Search WWH ::




Custom Search