TemperatureConverter
Last Revision: | |
Build Requirements: | Xcode 4.0 or later, Mac OS X v10.7 or later |
Runtime Requirements: | Mac OS X v10.7 or later |
A simple example using NSValueTransformer to automatically convert data between different representations. The purpose of this example is to show how to create and use custom NSValueTransformer subclasses. Otherwise it is possible to create a temperature converter using "regular glue code" with less lines of code.
Temperature Converter presents a simple user interface through which the user can enter temperature values in any of four different units and the application will automatically convert and display the temperature in the other three units. The four units are Kelvin, Centigrade, Fahrenheit, and-- the infrequently used-- Rankine temperature scale.
Internally, the application stores temperature values in Kelvin and uses value transformers to transform the entered temperature value to Kelvin and then from Kelvin to the other scales needed.
Copyright © 2012 Apple Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2012-06-05