Context Navigation

Add Outlets and Actions

Using the "+" button below the "Class Outlets" section of the Inspector, add outlets to the ConverterController class. The outlets you need to add are named "amountField", "converter", "dollarField", and "rateField".

We'll connect each of the "field" outlets to one of the text fields in the CurrencyConverter UI, and we'll connect the "converter" outlet to the Converter instance that we created before. When the application launches, it creates the Converter and ConverterController instances and establishes the connections that we specify in the nibfile.

First, though, we need to tell the nibfile about actions as well as outlets. With the "ConverterController" instance selected, use the "+" button below the "Class Actions" section to add a new action. Name the action "convert:":

In this application, the "convert:" action is the only action defined for the user interface, so we are done with actions now. In more complex applications you may need to define many actions and outlets.

Now we'll connect outlets to objects and actions.

Add Connections

InterfaceBuilder? enables you to connect objects by Control-dragging from one to another. To Control-drag, you hold down the Control key while dragging from one object to the next.

Select the "ConverterController" instance in the nibfile's main window, and Control-drag a connection to the "Exchange rate" text field in the application's main window. (Be sure to connect to the text field, not to its label!) When you release the mouse button, InterfaceBuilder pops up a menu that lists the available outlets. Choose "rateField" from the menu. The "rateField" outlet of the "ConverterController" instance is now connected to the "Exchange rate" text field.