Define the Classes of Travel Advisor
Travel Advisor has three classes: Country, Converter, and TAController. Only TAController has outlets and actions. And, rather than defining the Converter class, you are simply going to add it to the project from the Currency Converter project and reuse it.
Specify the Country and TAController Classes
Subclass NSObject to create the Country and TAController classes.
In Interface Builder, bring up the Classes display of the nib file window.
Select NSObject as the superclass.
Choose Subclass from the Classes menu.
Type
Country
in place ofMyObject
.Repeat for TAController.
Specify TAController’s Outlets and Actions
Now that the interface has been laid out, you can define the outlets that let TAController communicate with the UI objects. While here, you can also add the outlet for the Converter object that will be reused from the Currency Converter project.
Select TAController and choose Add Outlet from the Classes menu.
Add the following outlets:
celsiusField commentsField commentsLabel converter countryField countryTableView currencyDollarsField currencyLocalField currencyNameField currencyRateField englishSpokenSwitch fahrenheitField languagesField logisticsForm
In addition to outlets, you must specify actions so that the UI objects can message TAController.
Select TAController and choose Add Action from the Classes menu:
Define the following action methods:
addRecord: blankFields: convertCurrency: convertTemp: deleteRecord: handleTVClick: ...
Get Learning Cocoa now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.