Information Technology Reference
In-Depth Information
Creating a Simple iOS Project with IB
In Xcode 3, adding objects and linking them to code was a repetitive chore. With IB in Xcode 4, the process has
been simplified. This section demonstrates how to use IB to create a very simple app, with a text label and a
button. Tapping the button triggers code that reads the text from the label and changes it. The code uses one ac-
tion, which is triggered by the button, and one outlet, which connects the label in the UI to a corresponding in-
stance of UILabel in the code.
When you create a UI, you drag objects from the Object library and drop them onto a view. The Object library
appears in the area at the bottom right of the Utility pane. By default it's partially hidden, but you can drag a di-
vider above the icon bar upward to show more of it. The larger your monitor, the more of the library you can
see without scrolling.
CAUTION
If you have a small monitor, this feature can be difficult to work with because you continually have to scroll
through it, and move the divider to show object properties so you can edit them. You can save time by creating
one tab in which the Object library fills the right hand area, and another in which only the properties are visible.
The Object library shares this lower area with other libraries, including a File Template library, a Code Snippet
library, and a Media library. To select the Object library, click the cube icon, which is third from the left. Objects
in the library are pre-filtered by the project OS; you can't add iOS objects to a Mac project, and vice versa.
Search WWH ::




Custom Search