O'Reilly logo

Learning Cocoa by Apple Computer Inc

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Connect ConverterController to the Interface

In this section you’ll create an instance of ConverterController and use Interface Builder to connect the controller object’s outlets to objects in the user interface.

Generate an Instance of the Class

As the final step of defining a class in Interface Builder, create an instance of your class and connect its outlets and actions:

  1. Select ConverterController in the Classes window, if it is not already selected.

  2. Choose Instantiate from the Classes menu. The instance will appear in the Instances view, as highlighted in Figure 7.21.

    The ConverterController instance

    Figure 7-21. The ConverterController instance

Connect the Custom Class to the Interface

Now you can connect this ConverterController object to the user interface. By connecting it to specific objects in the interface, you initialize its outlets. ConverterController will use these outlets to get and set values in the interface.

  1. In the Instances display of the nib file window, Control-drag a connection line from the ConverterController instance to the first text field, as shown in Figure 7.22. When the text field is outlined, release the mouse button.

    Connecting the ConverterController instance to a text field

    Figure 7-22. Connecting the ConverterController instance to a text field

  2. Interface Builder brings up the Connections display of the Info window. Select the outlet that ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required