Apple Developer Connection
Member Login Log In | Not a Member? Contact ADC

< Previous PageNext Page > Hide TOC

Defining the Outlets for the ConverterController Class

The ConverterController object needs to communicate with the user interface elements in the Currency Converter window. It must also communicate with an instance of the Converter class, defined in “Defining the Model.” The Converter class implements the conversion computation.

The file ConverterController.h should be open for editing. If it is not, open it in Xcode. Now, you are going to add the outlets required by the ConverterController class. Currently, the ConverterController class is defined as an empty class inheriting from the NSObject class. You will need to add three outlets: one for each of the three text fields in the view. Add the following lines in between the brackets of the ConverterController class:

IBOutlet NSTextField *amountField;
IBOutlet NSTextField *dollarField;
IBOutlet NSTextField *rateField;

Notice that the three text field outlets are of type NSTextField. Because Objective-C is a dynamically typed language, it’s fine to define all the outlets as type id. However, it’s a good idea to get into the habit of setting the types for outlets since statically typed instance variables receive much better compile-time error checking.



< Previous PageNext Page > Hide TOC


Last updated: 2007-10-31




Did this document help you?
Yes: Tell us what works for you.

It’s good, but: Report typos, inaccuracies, and so forth.

It wasn’t helpful: Tell us what would have helped.
Get information on Apple products.
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Copyright © 2007 Apple Inc.
All rights reserved. | Terms of use | Privacy Notice