Information Technology Reference
In-Depth Information
TIP
There's more than one way to create a link in IB. You can hold down the control key, and drag links directly from
objects in the UI or the object list, to the Connections Inspector, or to the code. You can even type your own out-
let code and make connections to it. IB doesn't allow you to make links that are meaningless. Dragging links from
the Connections Inspector to the code is usually the fastest, simplest, and clearest option.
FIGURE 7.31
The finished app, running in the Simulator
NOTE
As of iOS 3.2 you can create an outlet collection— a group of outlets held in a standard NSArray . Use this option
when you want to collect a single object—often a controller—to multiple UI elements. To create a collection, drag
a link from the New Referencing Outlet Collection item to your controller. Collections are optional, but they can
be useful when you need to update multiple objects. For example, you can use NSArray's makeObjectsPer-
formSelector: method to update every object in a collection with a single line of code.
Understanding the IB object hierarchy
Select the label in the UI, and use the Arrange menu in the Size Inspector to center it vertically. Do the same
with the button. The two objects overlap, as shown in Figure 7.32.
Search WWH ::




Custom Search