Creating an Outlet Connection
To enable your code to send messages to a user interface object (telling a label to display a text string, for example, or telling a button to appear or disappear), create a connection from the user interface object to an outlet in your code.
Select a storyboard or xib file in the project navigator.
The file’s contents open in Interface Builder.
In Interface Builder, select the user interface object that will receive the messages.
The user interface object can be a control or any other object defined in your storyboard of xib file, such as a label, progress indicator, or map view. You can select the object either by clicking it in the outline view or on the canvas. If the outline view doesn’t appear, display it by clicking the Show Document Outline () control in the lower-left corner of the canvas. Select a control from the list of nested objects.
Choose View > Assistant Editor > Show Assistant Editor.
In the assistant editor, use the jump bar to select the implementation file of the object that will send the messages.
The implementation file
APAViewController.mis selected in the jump bar below.
Control-drag from the object in Interface Builder to the implementation file in the assistant editor.
Xcode indicates where you can insert an outlet declaration in your code.
Release the Control-drag.
The assistant editor displays a Connection menu.
Choose Outlet from the Connection menu.
Type the name of the new outlet and click Connect.
Interface Builder adds the declaration for the outlet to the class. (Outlets are defined as
IBOutletkeyword tells Xcode that this property can be connected to your storyboard or xib file.)