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

Implement the Classes of Currency Converter

The final step in building the Currency Converter application is to implement the classes you defined in the previous steps.

Generate the Source Files

  1. Go to the Classes display of the nib file window.

  2. Select the ConverterController class.

  3. Choose Create Files from the Classes menu.

  4. Verify that the checkboxes in the Create column next to the .h and .m files are selected.

  5. Verify that the checkbox next to Currency Converter is selected.

  6. Click the Choose button.

  7. Repeat for the Converter class.

  8. Save the nib file.

Now we leave Interface Builder for this application. You’ll complete the application using Project Builder.

Examine an Interface (Header) File in Project Builder

When Interface Builder adds the header and source files to the Currency Converter project, it tries to put them in the same group folder as other source files in the same disk folder. Since the newly created files are class implementations, move them to the Classes group if Interface Builder did not do so automatically.

  1. Click Project Builder’s main window to activate it.

  2. Select all four files in the Groups and Files list and drag them into the Classes group, as shown in Figure 7.23.

    Adding the source files to the Classes group

    Figure 7-23. Adding the source files to the Classes group

Add a Method Declaration

You can add instance variables or method declarations to a header file generated by Interface Builder. This is commonly ...

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